Skip to content

Commit 743c5e9

Browse files
MaxNumeriquegithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent 5f87529 commit 743c5e9

File tree

4 files changed

+17
-34
lines changed

4 files changed

+17
-34
lines changed

src/opengeodeweb_back/data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def create(
4141
database.session.flush()
4242
return data_entry
4343

44-
4544
@classmethod
4645
def get(cls, data_id: str) -> "Data | None":
4746
return database.session.get(cls, data_id)

src/opengeodeweb_back/geode_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ def load_data_by_id(data_id: str):
5858
data_entry = Data.get(data_id)
5959
if not data_entry:
6060
flask.abort(404, f"Data with id {data_id} not found")
61-
61+
6262
file_absolute_path = data_file_path(data_id, data_entry.native_file_name)
63-
63+
6464
return load(data_entry.geode_object, file_absolute_path)
6565

6666

6767
def get_data_info(data_id: str):
6868
from .data import Data
69+
6970
data_entry = Data.get(data_id)
7071
if not data_entry:
7172
flask.abort(404, f"Data with id {data_id} not found")

tests/test_models_routes.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,16 @@ def test_model_mesh_components(client, test_id):
3131
def test_extract_brep_uuids(client, test_id):
3232
route = "/models/mesh_components"
3333
brep_filename = "cube.og_brep"
34-
35-
with client.application.app_context():
36-
data_entry = Data.create(
37-
geode_object="BRep",
38-
input_file=brep_filename
39-
)
34+
35+
with client.application.app_context():
36+
data_entry = Data.create(geode_object="BRep", input_file=brep_filename)
4037
data_entry.native_file_name = brep_filename
4138
database.session.commit()
42-
39+
4340
data_path = geode_functions.data_file_path(data_entry.id, brep_filename)
4441
os.makedirs(os.path.dirname(data_path), exist_ok=True)
4542
shutil.copy(f"./tests/data/{brep_filename}", data_path)
46-
43+
4744
json_data = {"id": data_entry.id}
4845
response = client.post(route, json=json_data)
4946

tests/test_routes.py

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,9 @@ def get_full_data():
169169
test_utils.test_route_wrong_params(client, route, get_full_data)
170170

171171

172-
def test_texture_coordinates(client, test_id):
172+
def test_texture_coordinates(client, test_id):
173173
with client.application.app_context():
174-
data = Data.create(
175-
geode_object="PolygonalSurface3D",
176-
input_file="hat.vtp"
177-
)
174+
data = Data.create(geode_object="PolygonalSurface3D", input_file="hat.vtp")
178175
data.native_file_name = "hat.vtp"
179176
database.session.commit()
180177

@@ -185,9 +182,7 @@ def test_texture_coordinates(client, test_id):
185182

186183
response = client.post(
187184
"/texture_coordinates",
188-
json={
189-
"id": data.id
190-
},
185+
json={"id": data.id},
191186
)
192187
assert response.status_code == 200
193188
texture_coordinates = response.json["texture_coordinates"]
@@ -198,12 +193,9 @@ def test_texture_coordinates(client, test_id):
198193

199194
def test_vertex_attribute_names(client, test_id):
200195
route = f"/vertex_attribute_names"
201-
196+
202197
with client.application.app_context():
203-
data = Data.create(
204-
geode_object="PolygonalSurface3D",
205-
input_file="test.vtp"
206-
)
198+
data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
207199
data.native_file_name = "test.vtp"
208200
database.session.commit()
209201

@@ -222,12 +214,9 @@ def test_vertex_attribute_names(client, test_id):
222214

223215
def test_polygon_attribute_names(client, test_id):
224216
route = f"/polygon_attribute_names"
225-
217+
226218
with client.application.app_context():
227-
data = Data.create(
228-
geode_object="PolygonalSurface3D",
229-
input_file="test.vtp"
230-
)
219+
data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
231220
data.native_file_name = "test.vtp"
232221
database.session.commit()
233222

@@ -245,12 +234,9 @@ def test_polygon_attribute_names(client, test_id):
245234

246235
def test_polyhedron_attribute_names(client, test_id):
247236
route = f"/polyhedron_attribute_names"
248-
237+
249238
with client.application.app_context():
250-
data = Data.create(
251-
geode_object="PolyhedralSolid3D",
252-
input_file="test.vtu"
253-
)
239+
data = Data.create(geode_object="PolyhedralSolid3D", input_file="test.vtu")
254240
data.native_file_name = "test.vtu"
255241
database.session.commit()
256242

0 commit comments

Comments
 (0)