-
Notifications
You must be signed in to change notification settings - Fork 23
enhance tests #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhance tests #494
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
최신 브랜치로 현행화하면 GitHubModelsConnectorTests
, HuggingFaceConnectorTests
, OpenAIConnectorTests
의 변경사항을 볼 수 있어요.
Ollama, HuggingFace, LG 커넥터에서 GetChatClient 메소드는 아마 단위테스트가 안 될 겁니다. 의존성 개체를 외부에서 주입하는 것이 아니라 내부에서 생성하기 때문입니다. 최신 브랜치로 현행화 하면 관련 내용을 확인할 수 있을 거예요.
test/OpenChat.PlaygroundApp.Tests/Abstractions/LanguageModelConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Abstractions/LanguageModelConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Abstractions/LanguageModelConnectorTests.cs
Show resolved
Hide resolved
일단 Abstraction 테스트들 먼저 수정하고, 이후에 Main에 새로 추가된 Connector들 테스트도 같이 보겠습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 가지
ArgumentOptionsTests
와LanguageModelSettingsTests
를 보면 아래와 같은 부분이 있습니다.
public void Test_Method(Type type)
{
// Act
var isSubclass = type.IsSubclassOf(typeof(ArgumentOptions));
// Assert
isSubclass.ShouldBeTrue();
}
다른 테스트와 마찬가지로 IsAssignableFrom()
메소드로 바꿉시다.
public void Test_Method(Type derivedType)
{
// Arrange
var baseType = typeof(ArgumentOptions);
// Act
var result = baseType.IsAssignableFrom(derivedType);
// Assert
result.ShouldBeTrue();
}
- 쭉 보다 보니... 맞춰야 할 것이 있습니다. 일구님은 아마 아래 처럼 하고 싶은 모양인 것 같아요.
public async Task Test_Method_Name()
{
...
// Act
Func<Task> func = XxxxAsync();
// Assert
var ex = await func.ShouldThrowAsync<T>();
ex.Message.ShouldContain(...);
}
근데 아래처럼 하는 것이 더 낫습니다. 이유는 Fluent API를 바로 쓸 수 있기 때문인데요, 위처럼 하면 일단 ex
를 한 번 받아와야하는 상황이 생깁니다. 아래처럼 Fluent API 방식을 도입하면 조금 더 테스트 결과 확인이 계속 하나의 컨텍스트 안에서 이어지니 좀 더 수월할 거예요.
public void Test_Method_Name()
{
...
// Act
Func<Task> func = async () => await XxxxAsync();
// Assert
func.ShouldThrowAsync<T>()
.Message.ShouldContain(...);
}
어떻게 생각하세요?
test/OpenChat.PlaygroundApp.Tests/Abstractions/LanguageModelConnectorTests.cs
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/HuggingFaceConnectorTests.cs
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/HuggingFaceConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/OpenAIConnectorTests.cs
Outdated
Show resolved
Hide resolved
@sikutisa 커넥터가 하나둘씩 머지될 때 마다 범위가 넓어집니다. 후다닥 해치우시죠? |
Related to: aliencube#451
Related to: aliencube#451
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
몇군데 false alarm 으로 자동수정된 부분들 수정하는 거랑 기존에 수정 요청 놓쳤던 거랑 해 보시면 될 듯 합니다.
test/OpenChat.PlaygroundApp.Tests/Connectors/AzureAIFoundryConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/AzureAIFoundryConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/AzureAIFoundryConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/UpstageConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/GitHubModelsConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/HuggingFaceConnectorTests.cs
Outdated
Show resolved
Hide resolved
test/OpenChat.PlaygroundApp.Tests/Connectors/HuggingFaceConnectorTests.cs
Outdated
Show resolved
Hide resolved
Related to: aliencube#451
Related to: aliencube#451
Related to: aliencube#451
Related to: aliencube#451
Related to: aliencube#451
|
Related to: aliencube#451
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 수고하셨습니다!
Purpose
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
README updated?
The top-level readme for this repo contains a link to each sample in the repo. If you're adding a new sample did you update the readme?
Other Information
HuggingFaceConnectorTests
의Given_Valid_Settings_When_GetChatClient_Invoked_Then_It_Should_Return_ChatClient
를 Unit Test로 변경하고 싶은데, 마땅한 방법이 안 떠오르네요