Skip to content

Commit 65517a8

Browse files
SpliiTgithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent cb2c549 commit 65517a8

File tree

5 files changed

+39
-62
lines changed

5 files changed

+39
-62
lines changed

requirements.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
5-
# pip-compile --cert=None --client-cert=None --index-url=None --pip-args=None requirements.in
5+
# pip-compile --output-file=./requirements.txt --pre ./requirements.in
66
#
7-
asgiref==3.10.0
7+
asgiref~=3.10
88
# via flask
9-
blinker==1.9.0
9+
blinker~=1.9
1010
# via flask
11-
click==8.3.0
11+
click~=8.3
1212
# via flask
13-
flask[async]==3.1.2
13+
flask[async]~=3.1
1414
# via
1515
# -r requirements.in
1616
# flask-cors
@@ -25,13 +25,13 @@ geode-common==33.11.0
2525
# geode-viewables
2626
geode-viewables==3.3.0
2727
# via -r requirements.in
28-
greenlet==3.2.4
28+
greenlet~=3.2
2929
# via sqlalchemy
30-
itsdangerous==2.2.0
30+
itsdangerous~=2.2
3131
# via flask
32-
jinja2==3.1.6
32+
jinja2~=3.1
3333
# via flask
34-
markupsafe==3.0.3
34+
markupsafe~=3.0
3535
# via
3636
# flask
3737
# jinja2
@@ -59,9 +59,9 @@ opengeode-io==7.4.0
5959
# -r requirements.in
6060
# geode-viewables
6161
# opengeode-geosciencesio
62-
sqlalchemy==2.0.43
62+
sqlalchemy~=2.0
6363
# via flask-sqlalchemy
64-
typing-extensions==4.15.0
64+
typing-extensions~=4.15
6565
# via sqlalchemy
6666
werkzeug==3.1.2
6767
# via

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def save_viewable_file():
257257
200,
258258
)
259259

260+
260261
with open(os.path.join(schemas, "texture_coordinates.json"), "r") as file:
261262
texture_coordinates_json = json.load(file)
262263

src/opengeodeweb_back/routes/create/blueprint_create.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
with open(os.path.join(schemas, "create_point.json"), "r") as file:
2323
create_point_json = json.load(file)
2424

25-
@routes.route(
26-
create_point_json["route"],
27-
methods=create_point_json["methods"]
28-
)
25+
26+
@routes.route(create_point_json["route"], methods=create_point_json["methods"])
2927
def create_point():
3028
"""Endpoint to create a single point in 3D space."""
3129
print(f"create_point : {flask.request=}", flush=True)
@@ -47,10 +45,7 @@ def create_point():
4745

4846
# Save and get info
4947
result = save_all_viewables_and_return_info(
50-
geode_object="PointSet3D",
51-
data=point_set,
52-
input_file=None,
53-
additional_files=[]
48+
geode_object="PointSet3D", data=point_set, input_file=None, additional_files=[]
5449
)
5550

5651
# Prepare response with the title
@@ -62,7 +57,7 @@ def create_point():
6257
"object_type": result["object_type"],
6358
"geode_object": result["geode_object"],
6459
}
65-
60+
6661
# Add binary_light_viewable if it exists
6762
if "binary_light_viewable" in result:
6863
response["binary_light_viewable"] = result["binary_light_viewable"]
@@ -74,10 +69,8 @@ def create_point():
7469
with open(os.path.join(schemas, "create_aoi.json"), "r") as file:
7570
create_aoi_json = json.load(file)
7671

77-
@routes.route(
78-
create_aoi_json["route"],
79-
methods=create_aoi_json["methods"]
80-
)
72+
73+
@routes.route(create_aoi_json["route"], methods=create_aoi_json["methods"])
8174
def create_aoi():
8275
"""Endpoint to create an Area of Interest (AOI) as an EdgedCurve3D."""
8376
print(f"create_aoi : {flask.request=}", flush=True)
@@ -106,9 +99,7 @@ def create_aoi():
10699
for i in range(num_vertices):
107100
edge_id = builder.create_edge()
108101
next_i = (i + 1) % num_vertices # Wrap around to close the loop
109-
builder.set_edge_vertex(
110-
opengeode.EdgeVertex(edge_id, 0), vertex_indices[i]
111-
)
102+
builder.set_edge_vertex(opengeode.EdgeVertex(edge_id, 0), vertex_indices[i])
112103
builder.set_edge_vertex(
113104
opengeode.EdgeVertex(edge_id, 1), vertex_indices[next_i]
114105
)
@@ -118,7 +109,7 @@ def create_aoi():
118109
geode_object="EdgedCurve3D",
119110
data=edged_curve,
120111
input_file=None,
121-
additional_files=[]
112+
additional_files=[],
122113
)
123114

124115
# Prepare response
@@ -130,7 +121,7 @@ def create_aoi():
130121
"object_type": result["object_type"],
131122
"geode_object": result["geode_object"],
132123
}
133-
124+
134125
# Add binary_light_viewable if it exists
135126
if "binary_light_viewable" in result:
136127
response["binary_light_viewable"] = result["binary_light_viewable"]

src/opengeodeweb_back/utils_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def create_data_folder_from_id(data_id: str) -> str:
163163
def save_all_viewables_and_return_info(
164164
geode_object: str,
165165
data: Any,
166-
input_file: str | None = None,
166+
input_file: str | None = None,
167167
additional_files: list[str] | None = None,
168168
) -> dict[str, Any]:
169169
if additional_files is None:

tests/test_create_routes.py

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
# Local application imports
99
from src.opengeodeweb_back import test_utils
1010

11+
1112
@pytest.fixture
1213
def point_data():
13-
return {
14-
"title": "test_point",
15-
"x": 1.0,
16-
"y": 2.0,
17-
"z": 3.0
18-
}
14+
return {"title": "test_point", "x": 1.0, "y": 2.0, "z": 3.0}
15+
1916

2017
@pytest.fixture
2118
def aoi_data():
@@ -25,11 +22,12 @@ def aoi_data():
2522
{"x": 0.0, "y": 0.0},
2623
{"x": 1.0, "y": 0.0},
2724
{"x": 1.0, "y": 1.0},
28-
{"x": 0.0, "y": 1.0}
25+
{"x": 0.0, "y": 1.0},
2926
],
30-
"z": 0.0
27+
"z": 0.0,
3128
}
3229

30+
3331
def test_create_point(client, point_data):
3432
"""Test the creation of a point with valid data."""
3533
route = "/opengeodeweb_back/create/create_point"
@@ -54,6 +52,7 @@ def test_create_point(client, point_data):
5452
# Test with missing parameters - IMPORTANT: use .copy() to avoid mutation
5553
test_utils.test_route_wrong_params(client, route, lambda: point_data.copy())
5654

55+
5756
def test_create_aoi(client, aoi_data):
5857
"""Test the creation of an AOI with valid data."""
5958
route = "/opengeodeweb_back/create/create_aoi"
@@ -78,29 +77,22 @@ def test_create_aoi(client, aoi_data):
7877
# Test with missing parameters - IMPORTANT: use .copy() to avoid mutation
7978
test_utils.test_route_wrong_params(client, route, lambda: aoi_data.copy())
8079

80+
8181
def test_create_point_with_invalid_data(client):
8282
"""Test the point creation endpoint with invalid data."""
8383
route = "/opengeodeweb_back/create/create_point"
8484

8585
# Test with non-numeric coordinates
86-
invalid_data = {
87-
"title": "invalid_point",
88-
"x": "not_a_number",
89-
"y": 2.0,
90-
"z": 3.0
91-
}
86+
invalid_data = {"title": "invalid_point", "x": "not_a_number", "y": 2.0, "z": 3.0}
9287
response = client.post(route, json=invalid_data)
9388
assert response.status_code == 400
9489

9590
# Test with missing coordinates
96-
invalid_data = {
97-
"title": "invalid_point",
98-
"y": 2.0,
99-
"z": 3.0
100-
}
91+
invalid_data = {"title": "invalid_point", "y": 2.0, "z": 3.0}
10192
response = client.post(route, json=invalid_data)
10293
assert response.status_code == 400
10394

95+
10496
def test_create_aoi_with_invalid_data(client, aoi_data):
10597
"""Test the AOI creation endpoint with invalid data."""
10698
route = "/opengeodeweb_back/create/create_aoi"
@@ -112,31 +104,23 @@ def test_create_aoi_with_invalid_data(client, aoi_data):
112104
{"x": "not_a_number", "y": 0.0},
113105
{"x": 1.0, "y": 0.0},
114106
{"x": 1.0, "y": 1.0},
115-
{"x": 0.0, "y": 1.0}
116-
]
107+
{"x": 0.0, "y": 1.0},
108+
],
117109
}
118110
response = client.post(route, json=invalid_data)
119111
assert response.status_code == 400
120112

121113
# Test with too few points
122-
invalid_data = {
123-
**aoi_data,
124-
"points": [
125-
{"x": 0.0, "y": 0.0},
126-
{"x": 1.0, "y": 0.0}
127-
]
128-
}
114+
invalid_data = {**aoi_data, "points": [{"x": 0.0, "y": 0.0}, {"x": 1.0, "y": 0.0}]}
129115
response = client.post(route, json=invalid_data)
130116
assert response.status_code == 400
131117

132118
# Test with invalid z value
133-
invalid_data = {
134-
**aoi_data,
135-
"z": "not_a_number"
136-
}
119+
invalid_data = {**aoi_data, "z": "not_a_number"}
137120
response = client.post(route, json=invalid_data)
138121
assert response.status_code == 400
139122

123+
140124
def test_create_point_file_generation(client, point_data):
141125
"""Test that the point creation generates the correct files."""
142126
route = "/opengeodeweb_back/create/create_point"
@@ -172,6 +156,7 @@ def test_create_point_file_generation(client, point_data):
172156
assert response_data["native_file_name"].endswith(".og_pts3d")
173157
assert response_data["viewable_file_name"].endswith(".vtp")
174158

159+
175160
def test_create_aoi_file_generation(client, aoi_data):
176161
"""Test that the AOI creation generates the correct files."""
177162
route = "/opengeodeweb_back/create/create_aoi"

0 commit comments

Comments
 (0)