Skip to content

Commit 739d8f9

Browse files
committed
Ran formatter
1 parent c578c48 commit 739d8f9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/integration/test_ontology.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import json
66
import time
77

8+
89
def test_feature_schema_is_not_archived(client, ontology):
910
feature_schema_to_check = ontology.normalized['tools'][0]
1011
result = client.is_feature_schema_archived(
@@ -31,6 +32,7 @@ def test_is_feature_schema_archived_for_non_existing_feature_schema(
3132
client.is_feature_schema_archived(ontology.uid,
3233
'invalid-feature-schema-id')
3334

35+
3436
def test_is_feature_schema_archived_for_non_existing_ontology(client, ontology):
3537
feature_schema_to_unarchive = ontology.normalized['tools'][0]
3638
with pytest.raises(
@@ -40,6 +42,7 @@ def test_is_feature_schema_archived_for_non_existing_ontology(client, ontology):
4042
client.is_feature_schema_archived(
4143
'invalid-ontology', feature_schema_to_unarchive['featureSchemaId'])
4244

45+
4346
def test_delete_tool_feature_from_ontology(client, ontology):
4447
feature_schema_to_delete = ontology.normalized['tools'][0]
4548
assert len(ontology.normalized['tools']) == 2
@@ -50,6 +53,7 @@ def test_delete_tool_feature_from_ontology(client, ontology):
5053
updatedOntology = client.get_ontology(ontology.uid)
5154
assert len(updatedOntology.normalized['tools']) == 1
5255

56+
5357
@pytest.mark.skip(reason="normalized ontology contains Relationship, "
5458
"which is not finalized yet. introduce this back when"
5559
"Relationship feature is complete and we introduce"
@@ -58,12 +62,14 @@ def test_from_project_ontology(project) -> None:
5862
o = OntologyBuilder.from_project(project)
5963
assert o.asdict() == project.ontology().normalized
6064

65+
6166
point = Tool(
6267
tool=Tool.Type.POINT,
6368
name="name",
6469
color="#ff0000",
6570
)
6671

72+
6773
def test_deletes_an_ontology(client):
6874
tool = client.upsert_feature_schema(point.asdict())
6975
feature_schema_id = tool.normalized['featureSchemaId']
@@ -76,6 +82,7 @@ def test_deletes_an_ontology(client):
7682

7783
client.delete_unused_feature_schema(feature_schema_id)
7884

85+
7986
def test_cant_delete_an_ontology_with_project(client):
8087
project = client.create_project(name="test project",
8188
media_type=MediaType.Image)
@@ -98,6 +105,7 @@ def test_cant_delete_an_ontology_with_project(client):
98105
client.delete_unused_ontology(ontology.uid)
99106
client.delete_unused_feature_schema(feature_schema_id)
100107

108+
101109
def test_cant_delete_an_ontology_that_doesnt_exist(client):
102110
with pytest.raises(
103111
Exception,
@@ -106,6 +114,7 @@ def test_cant_delete_an_ontology_that_doesnt_exist(client):
106114
):
107115
client.delete_unused_ontology("doesntexist")
108116

117+
109118
def test_inserts_a_feature_schema_at_given_position(client):
110119
tool1 = {'tool': 'polygon', 'name': 'tool1', 'color': 'blue'}
111120
tool2 = {'tool': 'polygon', 'name': 'tool2', 'color': 'blue'}
@@ -123,6 +132,7 @@ def test_inserts_a_feature_schema_at_given_position(client):
123132

124133
client.delete_unused_ontology(ontology.uid)
125134

135+
126136
def test_moves_already_added_feature_schema_in_ontology(client):
127137
tool1 = {'tool': 'polygon', 'name': 'tool1', 'color': 'blue'}
128138
ontology_normalized_json = {"tools": [tool1], "classifications": []}
@@ -145,6 +155,7 @@ def test_moves_already_added_feature_schema_in_ontology(client):
145155

146156
client.delete_unused_ontology(ontology.uid)
147157

158+
148159
def test_does_not_include_used_ontologies(client):
149160
tool = client.upsert_feature_schema(point.asdict())
150161
feature_schema_id = tool.normalized['featureSchemaId']
@@ -163,12 +174,14 @@ def test_does_not_include_used_ontologies(client):
163174
client.delete_unused_ontology(ontology_with_project.uid)
164175
client.delete_unused_feature_schema(feature_schema_id)
165176

177+
166178
def _get_attr_stringify_json(obj, attr):
167179
value = getattr(obj, attr.name)
168180
if attr.field_type.name.lower() == "json":
169181
return json.dumps(value, sort_keys=True)
170182
return value
171183

184+
172185
def test_feature_schema_create_read(client, rand_gen):
173186
name = f"test-root-schema-{rand_gen(str)}"
174187
feature_schema_cat_normalized = {
@@ -197,6 +210,7 @@ def test_feature_schema_create_read(client, rand_gen):
197210
attr) == _get_attr_stringify_json(
198211
queried_feature_schema, attr)
199212

213+
200214
def test_ontology_create_read(client, rand_gen):
201215
ontology_name = f"test-ontology-{rand_gen(str)}"
202216
tool_name = f"test-ontology-tool-{rand_gen(str)}"

0 commit comments

Comments
 (0)