Skip to content

Commit 9752419

Browse files
committed
lint対象から除外する
1 parent e9d7d2d commit 9752419

File tree

4 files changed

+40
-15
lines changed

4 files changed

+40
-15
lines changed

generate/generate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ replace_from_dict_method() {
109109
replace_from_dict_method Movie system_metadata_movie.py
110110
replace_from_dict_method Image system_metadata_image.py
111111
replace_from_dict_method Custom system_metadata_custom.py
112+
replace_from_dict_method Classification full_annotation_data_classification.py
113+
replace_from_dict_method Segmentation full_annotation_data_segmentation.py
114+
replace_from_dict_method SegmentationV2 full_annotation_data_segmentation_v2.py
115+
112116

113117
cp out/openapi_client/models/*.py ../annofabapi/pydantic_models
114118
rm -Rf out/openapi_client
@@ -268,7 +272,7 @@ sed -e "s/__DictStrKeyAnyValue__/dict[str,Any]/g" ../annofabapi/dataclass/*.py
268272

269273

270274

271-
# rm -Rf out/openapi_client
275+
rm -Rf out/openapi_client
272276

273277

274278
cd ../

pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
ignore-paths=
44
annofabapi/generated_.*.py,
55
annofabapi/models.py,
6+
annofabapi/pydantic_models/
67

78
disable =
89
# ===== May not modify =====

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,17 @@ check_untyped_defs = true
7575

7676
plugins = ["numpy.typing.mypy_plugin"]
7777

78+
exclude = [
79+
'annofabapi/pydantic_models/.*\.py',
80+
]
81+
7882
[tool.ruff]
7983
target-version = "py39"
8084
line-length = 150
81-
exclude = ["annofabapi/__init__.py"]
85+
exclude = [
86+
"annofabapi/__init__.py",
87+
"annofabapi/pydantic_models/", # 自動生成したファイルはチェックしない
88+
]
8289

8390
[tool.ruff.lint]
8491
ignore = [

tests/test_pydantic_models.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
"""
2-
AnnofabApi, Wrapperのテストコード
3-
4-
"""
5-
6-
from __future__ import annotations
7-
81
import configparser
2+
import json
93

104
import annofabapi
5+
from annofabapi.pydantic_models.annotation_specs_v3 import AnnotationSpecsV3
116
from annofabapi.pydantic_models.input_data import InputData
127
from annofabapi.pydantic_models.project import Project
138
from annofabapi.pydantic_models.project_member import ProjectMember
9+
from annofabapi.pydantic_models.simple_annotation import SimpleAnnotation
1410
from annofabapi.pydantic_models.single_annotation import SingleAnnotation
1511
from annofabapi.pydantic_models.task import Task
1612

@@ -29,35 +25,52 @@
2925
service = annofabapi.build()
3026

3127

32-
def test_task():
28+
# 良く利用するモデルのみテストする
29+
# Errorが発生しないことを確認する
30+
31+
32+
def test__Task():
3333
content, _ = service.api.get_tasks(project_id)
3434
task = content["list"][0]
3535
actual = Task.from_dict(task)
3636
print(actual)
3737

3838

39-
def test_input_data():
39+
def test__InputData():
4040
content, _ = service.api.get_input_data_list(project_id)
4141
input_data = content["list"][0]
4242
actual = InputData.from_dict(input_data)
4343
print(actual)
4444

4545

46-
def test_project_member():
46+
def test__ProjectMember():
4747
content, _ = service.api.get_project_members(project_id)
4848
member = content["list"][0]
4949
actual = ProjectMember.from_dict(member)
5050
print(actual)
5151

5252

53-
def test_project():
53+
def test__Project():
5454
project, _ = service.api.get_project(project_id)
5555
actual = Project.from_dict(project)
5656
print(actual)
5757

5858

59-
def test_single_annotation():
60-
content, _ = service.api.get_annotation_list(project_id)
59+
def test_SingleAnnotation():
60+
content, _ = service.api.get_annotation_list(project_id, query_params={"v": "2"})
6161
annotation = content["list"][0]
6262
actual = SingleAnnotation.from_dict(annotation)
6363
print(actual)
64+
65+
66+
def test_AnnotationSpecsV3():
67+
content, _ = service.api.get_annotation_specs(project_id, query_params={"v": "3"})
68+
actual = AnnotationSpecsV3.from_dict(content)
69+
print(actual)
70+
71+
72+
def test__SimpleAnnotation():
73+
with open("tests/data/simple-annotation/sample_1/c86205d1-bdd4-4110-ae46-194e661d622b.json") as f:
74+
content = json.load(f)
75+
actual = SimpleAnnotation.from_dict(content)
76+
print(actual)

0 commit comments

Comments
 (0)