-
Notifications
You must be signed in to change notification settings - Fork 1
pydanticのテストコードを追加 #702
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
base: main
Are you sure you want to change the base?
pydanticのテストコードを追加 #702
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.
Pull Request Overview
This PR adds test code for pydantic models, specifically adding a test for TaskHistory and commenting out a test for Comment due to incorrect swagger.yaml definitions that cause errors.
- Adds a new test function
test__TaskHistory()
to verify TaskHistory model functionality - Comments out the
test__Comment()
function due to swagger.yaml definition issues - Imports the TaskHistory model to support the new test
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
# swagger.yamlの定義が間違っているためエラーが発生する | ||
# swagger.yamlの定義が修正されるまでコメントアウトする |
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.
[nitpick] The comment explains why the test is commented out, but it would be more helpful to include a reference to a tracking issue or ticket for when this will be fixed.
# swagger.yamlの定義が間違っているためエラーが発生する | |
# swagger.yamlの定義が修正されるまでコメントアウトする | |
# swagger.yamlの定義が修正されるまでコメントアウトする | |
# Tracking issue: https://github.com/your-org/your-repo/issues/1234 |
Copilot uses AI. Check for mistakes.
Titlepydanticのテストコードを追加 Description
Changes walkthrough 📝
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
def test__TaskHistory(): | ||
content, _ = service.api.get_task_histories(project_id, task_id) | ||
TaskHistory.from_dict(content[0]) |
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.
Suggestion: レスポンスのデータ構造に合わせてリストを取得し、要素が存在することをassertで検証してください。また、from_dict
の戻り値がTaskHistory
インスタンスであることをチェックすると、テストの信頼性が向上します。 [possible issue, importance: 6]
def test__TaskHistory(): | |
content, _ = service.api.get_task_histories(project_id, task_id) | |
TaskHistory.from_dict(content[0]) | |
def test__TaskHistory(): | |
content, _ = service.api.get_task_histories(project_id, task_id) | |
assert content.get("list"), "タスク履歴が返却されていません" | |
history = TaskHistory.from_dict(content["list"][0]) | |
assert isinstance(history, TaskHistory) |
Annofabのswagger.yamlの定義が間違っているため、いくつかのエラーが発生する。
それまでdraftモードにする。