Skip to content

Commit 56fe9ad

Browse files
author
Matt Sokoloff
committed
format tests
1 parent f1e19da commit 56fe9ad

File tree

4 files changed

+30
-45
lines changed

4 files changed

+30
-45
lines changed

tests/data/annotation_types/classification/test_classification.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def test_classification_answer():
1818
assert answer.schema_id is None
1919
assert answer.name == name
2020

21-
answer = ClassificationAnswer(schema_id=schema_id,
22-
name=name)
21+
answer = ClassificationAnswer(schema_id=schema_id, name=name)
2322

2423
assert answer.schema_id == schema_id
2524
assert answer.name == name
@@ -133,8 +132,7 @@ def test_radio():
133132
schema_id=schema_id,
134133
name=name,
135134
classifications=[
136-
ClassificationAnnotation(value=Radio(answer=answer),
137-
name=name)
135+
ClassificationAnnotation(value=Radio(answer=answer), name=name)
138136
])
139137
assert classification.dict() == {
140138
'name':
@@ -245,8 +243,7 @@ def test_dropdown():
245243
schema_id=schema_id,
246244
name=name,
247245
classifications=[
248-
ClassificationAnnotation(value=Dropdown(answer=[answer]),
249-
name=name)
246+
ClassificationAnnotation(value=Dropdown(answer=[answer]), name=name)
250247
])
251248
assert classification.dict() == {
252249
'name':

tests/data/annotation_types/test_annotation.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ def test_annotation():
3939
classifications=[line],
4040
)
4141

42-
subclass = ClassificationAnnotation(value=classification,
43-
name=name)
42+
subclass = ClassificationAnnotation(value=classification, name=name)
4443

4544
ObjectAnnotation(
4645
value=line,
@@ -55,15 +54,10 @@ def test_video_annotations():
5554

5655
# Wrong type
5756
with pytest.raises(ValidationError):
58-
VideoClassificationAnnotation(value=line,
59-
name=name,
60-
frame=1)
57+
VideoClassificationAnnotation(value=line, name=name, frame=1)
6158

6259
# Missing frames
6360
with pytest.raises(ValidationError):
6461
VideoClassificationAnnotation(value=line, name=name)
6562

66-
VideoObjectAnnotation(value=line,
67-
name=name,
68-
keyframe=True,
69-
frame=2)
63+
VideoObjectAnnotation(value=line, name=name, keyframe=True, frame=2)

tests/data/annotation_types/test_collection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ def test_adding_schema_ids():
8383
)
8484
])
8585
schema_id = "expected_id"
86-
ontology = OntologyBuilder(tools=[
87-
Tool(Tool.Type.LINE, name=name, feature_schema_id=schema_id)
88-
])
86+
ontology = OntologyBuilder(
87+
tools=[Tool(Tool.Type.LINE, name=name, feature_schema_id=schema_id)])
8988
generator = LabelGenerator([label]).assign_schema_ids(ontology)
9089
assert next(generator).annotations[0].schema_id == schema_id
9190
labels = LabelCollection([label]).assign_schema_ids(ontology)

tests/data/annotation_types/test_label.py

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ def test_schema_assignment_geometry():
2020
)
2121
])
2222
schema_id = "expected_id"
23-
ontology = OntologyBuilder(tools=[
24-
Tool(Tool.Type.LINE, name=name, feature_schema_id=schema_id)
25-
])
23+
ontology = OntologyBuilder(
24+
tools=[Tool(Tool.Type.LINE, name=name, feature_schema_id=schema_id)])
2625
label.assign_schema_ids(ontology)
2726

2827
assert label.annotations[0].schema_id == schema_id
@@ -35,10 +34,9 @@ def test_schema_assignment_classification():
3534

3635
label = Label(data=RasterData(arr=np.ones((32, 32, 3), dtype=np.uint8)),
3736
annotations=[
38-
ClassificationAnnotation(
39-
value=Radio(answer=ClassificationAnswer(
40-
name=option_name)),
41-
name=radio_name),
37+
ClassificationAnnotation(value=Radio(
38+
answer=ClassificationAnswer(name=option_name)),
39+
name=radio_name),
4240
ClassificationAnnotation(value=Text(answer="some text"),
4341
name=text_name)
4442
])
@@ -73,8 +71,7 @@ def test_schema_assignment_subclass():
7371
option_name = "my_option"
7472
classification = ClassificationAnnotation(
7573
name=radio_name,
76-
value=Radio(answer=ClassificationAnswer(
77-
name=option_name)),
74+
value=Radio(answer=ClassificationAnswer(name=option_name)),
7875
)
7976
label = Label(
8077
data=RasterData(arr=np.ones((32, 32, 3), dtype=np.uint8)),
@@ -117,8 +114,7 @@ def test_highly_nested():
117114
nested_option_name = "nested_option_name"
118115
classification = ClassificationAnnotation(
119116
name=radio_name,
120-
value=Radio(answer=ClassificationAnswer(
121-
name=option_name)),
117+
value=Radio(answer=ClassificationAnswer(name=option_name)),
122118
classifications=[
123119
ClassificationAnnotation(value=Radio(answer=ClassificationAnswer(
124120
name=nested_option_name)),
@@ -146,22 +142,21 @@ def test_highly_nested():
146142
instructions=radio_name,
147143
feature_schema_id=classification_schema_id,
148144
options=[
149-
Option(
150-
value=option_name,
151-
feature_schema_id=option_schema_id,
152-
options=[
153-
OClassification(
154-
class_type=OClassification.Type.RADIO,
155-
instructions=nested_name,
156-
feature_schema_id=
157-
nested_classification_schema_id,
158-
options=[
159-
Option(
160-
value=nested_option_name,
161-
feature_schema_id=
162-
nested_classification_schema_id)
163-
])
164-
])
145+
Option(value=option_name,
146+
feature_schema_id=option_schema_id,
147+
options=[
148+
OClassification(
149+
class_type=OClassification.Type.RADIO,
150+
instructions=nested_name,
151+
feature_schema_id=
152+
nested_classification_schema_id,
153+
options=[
154+
Option(
155+
value=nested_option_name,
156+
feature_schema_id=
157+
nested_classification_schema_id)
158+
])
159+
])
165160
])
166161
])
167162
])

0 commit comments

Comments
 (0)