1010# Local application imports 
1111from  src .opengeodeweb_back  import  test_utils 
1212
13+ 
1314@pytest .fixture  
1415def  point_data () ->  Dict [str , Any ]:
15-     return  {
16-         "name" : "test_point" ,
17-         "x" : 1.0 ,
18-         "y" : 2.0 ,
19-         "z" : 3.0 
20-     }
16+     return  {"name" : "test_point" , "x" : 1.0 , "y" : 2.0 , "z" : 3.0 }
17+ 
2118
2219@pytest .fixture  
2320def  aoi_data () ->  Dict [str , Any ]:
@@ -27,11 +24,12 @@ def aoi_data() -> Dict[str, Any]:
2724            {"x" : 0.0 , "y" : 0.0 },
2825            {"x" : 1.0 , "y" : 0.0 },
2926            {"x" : 1.0 , "y" : 1.0 },
30-             {"x" : 0.0 , "y" : 1.0 }
27+             {"x" : 0.0 , "y" : 1.0 }, 
3128        ],
32-         "z" : 0.0 
29+         "z" : 0.0 , 
3330    }
3431
32+ 
3533def  test_create_point (client : FlaskClient , point_data : Dict [str , Any ]) ->  None :
3634    """Test the creation of a point with valid data.""" 
3735    route : str  =  "/opengeodeweb_back/create/create_point" 
@@ -54,7 +52,8 @@ def test_create_point(client: FlaskClient, point_data: Dict[str, Any]) -> None:
5452    assert  response_data ["geode_object" ] ==  "PointSet3D" 
5553
5654    # Test with missing parameters 
57-     test_utils .test_route_wrong_params (client , route , lambda : point_data .copy ()) # type: ignore 
55+     test_utils .test_route_wrong_params (client , route , lambda : point_data .copy ())  # type: ignore 
56+ 
5857
5958def  test_create_aoi (client : FlaskClient , aoi_data : Dict [str , Any ]) ->  None :
6059    """Test the creation of an AOI with valid data.""" 
@@ -78,7 +77,8 @@ def test_create_aoi(client: FlaskClient, aoi_data: Dict[str, Any]) -> None:
7877    assert  response_data ["geode_object" ] ==  "EdgedCurve3D" 
7978
8079    # Test with missing parameters 
81-     test_utils .test_route_wrong_params (client , route , lambda : aoi_data .copy ())# type: ignore 
80+     test_utils .test_route_wrong_params (client , route , lambda : aoi_data .copy ())  # type: ignore 
81+ 
8282
8383def  test_create_point_with_invalid_data (client : FlaskClient ) ->  None :
8484    """Test the point creation endpoint with invalid data.""" 
@@ -89,21 +89,20 @@ def test_create_point_with_invalid_data(client: FlaskClient) -> None:
8989        "name" : "invalid_point" ,
9090        "x" : "not_a_number" ,
9191        "y" : 2.0 ,
92-         "z" : 3.0 
92+         "z" : 3.0 , 
9393    }
9494    response  =  client .post (route , json = invalid_data )
9595    assert  response .status_code  ==  400 
9696
9797    # Test with missing coordinates 
98-     invalid_data  =  {
99-         "name" : "invalid_point" ,
100-         "y" : 2.0 ,
101-         "z" : 3.0 
102-     }
98+     invalid_data  =  {"name" : "invalid_point" , "y" : 2.0 , "z" : 3.0 }
10399    response  =  client .post (route , json = invalid_data )
104100    assert  response .status_code  ==  400 
105101
106- def  test_create_aoi_with_invalid_data (client : FlaskClient , aoi_data : Dict [str , Any ]) ->  None :
102+ 
103+ def  test_create_aoi_with_invalid_data (
104+     client : FlaskClient , aoi_data : Dict [str , Any ]
105+ ) ->  None :
107106    """Test the AOI creation endpoint with invalid data.""" 
108107    route : str  =  "/opengeodeweb_back/create/create_aoi" 
109108
@@ -114,32 +113,26 @@ def test_create_aoi_with_invalid_data(client: FlaskClient, aoi_data: Dict[str, A
114113            {"x" : "not_a_number" , "y" : 0.0 },
115114            {"x" : 1.0 , "y" : 0.0 },
116115            {"x" : 1.0 , "y" : 1.0 },
117-             {"x" : 0.0 , "y" : 1.0 }
118-         ]
116+             {"x" : 0.0 , "y" : 1.0 }, 
117+         ], 
119118    }
120119    response  =  client .post (route , json = invalid_data )
121120    assert  response .status_code  ==  400 
122121
123122    # Test with too few points 
124-     invalid_data  =  {
125-         ** aoi_data ,
126-         "points" : [
127-             {"x" : 0.0 , "y" : 0.0 },
128-             {"x" : 1.0 , "y" : 0.0 }
129-         ]
130-     }
123+     invalid_data  =  {** aoi_data , "points" : [{"x" : 0.0 , "y" : 0.0 }, {"x" : 1.0 , "y" : 0.0 }]}
131124    response  =  client .post (route , json = invalid_data )
132125    assert  response .status_code  ==  400 
133126
134127    # Test with invalid z value 
135-     invalid_data  =  {
136-         ** aoi_data ,
137-         "z" : "not_a_number" 
138-     }
128+     invalid_data  =  {** aoi_data , "z" : "not_a_number" }
139129    response  =  client .post (route , json = invalid_data )
140130    assert  response .status_code  ==  400 
141131
142- def  test_create_point_file_generation (client : FlaskClient , point_data : Dict [str , Any ]) ->  None :
132+ 
133+ def  test_create_point_file_generation (
134+     client : FlaskClient , point_data : Dict [str , Any ]
135+ ) ->  None :
143136    """Test that the point creation generates the correct files.""" 
144137    route : str  =  "/opengeodeweb_back/create/create_point" 
145138
@@ -162,7 +155,9 @@ def test_create_point_file_generation(client: FlaskClient, point_data: Dict[str,
162155    assert  os .path .exists (native_file_path )
163156
164157    # Check viewable file exists 
165-     viewable_file_path : str  =  os .path .join (data_folder , response_data ["viewable_file_name" ])
158+     viewable_file_path : str  =  os .path .join (
159+         data_folder , response_data ["viewable_file_name" ]
160+     )
166161    assert  os .path .exists (viewable_file_path )
167162
168163    # Check light viewable file exists if present 
@@ -174,7 +169,10 @@ def test_create_point_file_generation(client: FlaskClient, point_data: Dict[str,
174169    assert  response_data ["native_file_name" ].endswith (".og_pts3d" )
175170    assert  response_data ["viewable_file_name" ].endswith (".vtp" )
176171
177- def  test_create_aoi_file_generation (client : FlaskClient , aoi_data : Dict [str , Any ]) ->  None :
172+ 
173+ def  test_create_aoi_file_generation (
174+     client : FlaskClient , aoi_data : Dict [str , Any ]
175+ ) ->  None :
178176    """Test that the AOI creation generates the correct files.""" 
179177    route : str  =  "/opengeodeweb_back/create/create_aoi" 
180178
@@ -197,7 +195,9 @@ def test_create_aoi_file_generation(client: FlaskClient, aoi_data: Dict[str, Any
197195    assert  os .path .exists (native_file_path )
198196
199197    # Check viewable file exists 
200-     viewable_file_path : str  =  os .path .join (data_folder , response_data ["viewable_file_name" ])
198+     viewable_file_path : str  =  os .path .join (
199+         data_folder , response_data ["viewable_file_name" ]
200+     )
201201    assert  os .path .exists (viewable_file_path )
202202
203203    # Check light viewable file exists if present 
@@ -207,4 +207,4 @@ def test_create_aoi_file_generation(client: FlaskClient, aoi_data: Dict[str, Any
207207
208208    # Verify file extensions 
209209    assert  response_data ["native_file_name" ].endswith (".og_edc3d" )
210-     assert  response_data ["viewable_file_name" ].endswith (".vtp" )
210+     assert  response_data ["viewable_file_name" ].endswith (".vtp" )
0 commit comments