Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/test_pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from annofabapi.pydantic_models.simple_annotation import SimpleAnnotation
from annofabapi.pydantic_models.single_annotation import SingleAnnotation
from annofabapi.pydantic_models.task import Task
from annofabapi.pydantic_models.task_history import TaskHistory

inifile = configparser.ConfigParser()
inifile.read("./pytest.ini", "UTF-8")
Expand All @@ -35,6 +36,21 @@ def test__Task():
Task.from_dict(task)


def test__TaskHistory():
content, _ = service.api.get_task_histories(project_id, task_id)
TaskHistory.from_dict(content[0])
Comment on lines +39 to +41
Copy link

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]

Suggested change
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)



# swagger.yamlの定義が間違っているためエラーが発生する
# swagger.yamlの定義が修正されるまでコメントアウトする
Comment on lines +44 to +45
Copy link

Copilot AI Aug 25, 2025

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.

Suggested change
# swagger.yamlの定義が間違っているためエラーが発生する
# swagger.yamlの定義が修正されるまでコメントアウトする
# swagger.yamlの定義が修正されるまでコメントアウトする
# Tracking issue: https://github.com/your-org/your-repo/issues/1234

Copilot uses AI. Check for mistakes.
# def test__Comment():
# with tempfile.NamedTemporaryFile() as temp_file:
# service.wrapper.download_project_comments_url(project_id, temp_file.name)
# with open(temp_file.name) as f:
# comments = json.load(f)
# Comment.from_dict(comments[0])


def test__InputData():
content, _ = service.api.get_input_data_list(project_id)
input_data = content["list"][0]
Expand Down
Loading