Skip to content

Commit 2af11be

Browse files
Apply prepare changes
1 parent 6f0c0a6 commit 2af11be

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

src/opengeodeweb_back/geode_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def create_crs(
7878
def get_object_type(geode_object: str):
7979
return geode_object_value(geode_object)["object_type"]
8080

81+
8182
def get_elements(geode_object: str):
8283
return geode_object_value(geode_object)["elements"]
8384

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def copy_data():
1414
shutil.rmtree("./data", ignore_errors=True)
1515
shutil.copytree("./tests/data", "./data", dirs_exist_ok=True)
1616

17+
1718
@pytest.fixture
1819
def client():
1920
app.config["TESTING"] = True

tests/test_routes.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,30 @@ def test_vertex_attribute_names(client):
170170
route = f"/vertex_attribute_names"
171171
for geode_object, value in geode_objects.geode_objects_dict().items():
172172
if value["object_type"] == "mesh":
173-
input_extensions = geode_functions.geode_object_input_extensions(geode_object)
173+
input_extensions = geode_functions.geode_object_input_extensions(
174+
geode_object
175+
)
174176
if "elements" in value:
175177
elements = geode_functions.get_elements(geode_object)
176178
if "points" in elements:
177179
for input_extension in input_extensions:
178-
is_loadable = geode_functions.is_loadable(geode_object, os.path.join("./data", f"test.{input_extension}"))
180+
is_loadable = geode_functions.is_loadable(
181+
geode_object,
182+
os.path.join("./data", f"test.{input_extension}"),
183+
)
179184
if is_loadable:
185+
180186
def get_full_data():
181187
return {
182188
"input_geode_object": geode_object,
183189
"filename": f"test.{input_extension}",
184190
}
191+
185192
response = client.post(route, json=get_full_data())
186193
assert response.status_code == 200
187-
vertex_attribute_names = response.json["vertex_attribute_names"]
194+
vertex_attribute_names = response.json[
195+
"vertex_attribute_names"
196+
]
188197
assert type(vertex_attribute_names) is list
189198
for vertex_attribute_name in vertex_attribute_names:
190199
assert type(vertex_attribute_name) is str
@@ -197,21 +206,30 @@ def test_polygon_attribute_names(client):
197206
route = f"/polygon_attribute_names"
198207
for geode_object, value in geode_objects.geode_objects_dict().items():
199208
if value["object_type"] == "mesh":
200-
input_extensions = geode_functions.geode_object_input_extensions(geode_object)
209+
input_extensions = geode_functions.geode_object_input_extensions(
210+
geode_object
211+
)
201212
if "elements" in value:
202213
elements = geode_functions.get_elements(geode_object)
203214
if "polygons" in elements:
204215
for input_extension in input_extensions:
205-
is_loadable = geode_functions.is_loadable(geode_object, os.path.join("./data", f"test.{input_extension}"))
216+
is_loadable = geode_functions.is_loadable(
217+
geode_object,
218+
os.path.join("./data", f"test.{input_extension}"),
219+
)
206220
if is_loadable:
221+
207222
def get_full_data():
208223
return {
209224
"input_geode_object": geode_object,
210225
"filename": f"test.{input_extension}",
211226
}
227+
212228
response = client.post(route, json=get_full_data())
213229
assert response.status_code == 200
214-
polygon_attribute_names = response.json["polygon_attribute_names"]
230+
polygon_attribute_names = response.json[
231+
"polygon_attribute_names"
232+
]
215233
assert type(polygon_attribute_names) is list
216234
for polygon_attribute_name in polygon_attribute_names:
217235
assert type(polygon_attribute_name) is str
@@ -224,21 +242,30 @@ def test_polyhedron_attribute_names(client):
224242
route = f"/polyhedron_attribute_names"
225243
for geode_object, value in geode_objects.geode_objects_dict().items():
226244
if value["object_type"] == "mesh":
227-
input_extensions = geode_functions.geode_object_input_extensions(geode_object)
245+
input_extensions = geode_functions.geode_object_input_extensions(
246+
geode_object
247+
)
228248
if "elements" in value:
229249
elements = geode_functions.get_elements(geode_object)
230250
if "polyhedrons" in elements:
231251
for input_extension in input_extensions:
232-
is_loadable = geode_functions.is_loadable(geode_object, os.path.join("./data", f"test.{input_extension}"))
252+
is_loadable = geode_functions.is_loadable(
253+
geode_object,
254+
os.path.join("./data", f"test.{input_extension}"),
255+
)
233256
if is_loadable:
257+
234258
def get_full_data():
235259
return {
236260
"input_geode_object": geode_object,
237261
"filename": f"test.{input_extension}",
238262
}
263+
239264
response = client.post(route, json=get_full_data())
240265
assert response.status_code == 200
241-
polyhedron_attribute_names = response.json["polyhedron_attribute_names"]
266+
polyhedron_attribute_names = response.json[
267+
"polyhedron_attribute_names"
268+
]
242269
assert type(polyhedron_attribute_names) is list
243270
for polyhedron_attribute_name in polyhedron_attribute_names:
244271
assert type(polyhedron_attribute_name) is str

0 commit comments

Comments
 (0)