Skip to content

Commit 04f4355

Browse files
committed
[TEST] Fixing tests that return stuff (breaking changing from pytest)
1 parent 84dc4ea commit 04f4355

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

test/test_api/test_model_construction_granular.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,51 @@
2323
"""
2424

2525
def test_read_input_points():
26+
_, _ = _read_data()
27+
28+
29+
def _read_data() -> tuple[OrientationsTable, SurfacePointsTable]:
2630
data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/'
2731
surface_points_file = pooch.retrieve(
2832
url=data_path + "data/input_data/jan_models/model1_surface_points.csv",
2933
known_hash="6f1a39ed77e87a4057f03629c946b1876b87e24409cadfe0e1cf7ab1488f69e4"
3034
)
31-
3235
orientations_file = pooch.retrieve(
3336
url=data_path + "data/input_data/jan_models/model1_orientations.csv",
3437
known_hash="04c307ae23f70252fe54144a2fb95ca7d96584a2d497ea539ed32dfd23e7cd5d"
3538
)
36-
3739
print(pooch.file_hash(surface_points_file))
3840
print(pooch.file_hash(orientations_file))
39-
4041
surface_points: SurfacePointsTable = read_surface_points(
4142
path=surface_points_file,
4243
)
43-
4444
orientations: OrientationsTable = read_orientations(
4545
path=orientations_file
4646
)
47+
return orientations, surface_points
48+
4749

48-
return surface_points, orientations
50+
def test_create_grid():
51+
_generate_grid()
4952

5053

51-
def test_create_grid() -> gp.data.Grid:
54+
def _generate_grid():
5255
grid: gp.data.Grid = gp.data.Grid(
5356
extent=[0, 1000, 0, 1000, 0, 500],
5457
resolution=[50, 5, 50]
5558
)
56-
5759
return grid
5860

5961

60-
def test_create_structural_frame() -> StructuralFrame:
62+
def test_create_structural_frame():
6163
# * Structural elements
62-
surface_points, orientations = test_read_input_points()
64+
_create_structural_frame()
65+
66+
67+
def _create_structural_frame():
68+
surface_points, orientations = _read_data()
6369
surface_points_groups = surface_points.get_surface_points_by_id_groups()
6470
orientations_groups = orientations.get_orientations_by_id_groups()
65-
6671
structural_elements = []
6772
color_gen = ColorsGenerator()
6873
for i in range(len(surface_points_groups)):
@@ -75,46 +80,46 @@ def test_create_structural_frame() -> StructuralFrame:
7580
)
7681

7782
structural_elements.append(structural_element)
78-
7983
# * Structural groups definitions
8084
default_formation: Stack = Stack(
8185
name="default_formation",
8286
elements=structural_elements,
8387
structural_relation=gp.data.StackRelationType.ERODE
8488
)
85-
8689
# ? Should I move this to the constructor?
8790
structural_frame: StructuralFrame = StructuralFrame(
8891
structural_groups=[default_formation],
8992
color_gen=color_gen
9093
)
91-
9294
return structural_frame
9395

9496

95-
def test_create_interpolation_options() -> InterpolationOptions:
97+
def test_create_interpolation_options():
98+
interpolation_options = _generate_interpolation_options()
99+
100+
101+
def _generate_interpolation_options():
96102
range_ = 1000.0
97103
interpolation_options: InterpolationOptions = InterpolationOptions.from_args(
98104
range=range_,
99105
c_o=(range_ ** 2) / 14 / 3,
100106
)
101-
102107
return interpolation_options
103108

104109

105110
def test_create_geomodel() -> GeoModel:
106111
geo_model: GeoModel = GeoModel.from_args(
107112
name="horizontal",
108-
structural_frame=test_create_structural_frame(),
109-
grid=test_create_grid(),
110-
interpolation_options=test_create_interpolation_options()
113+
structural_frame=_create_structural_frame(),
114+
grid=_generate_grid(),
115+
interpolation_options=_generate_interpolation_options()
111116
)
112117

113118
return geo_model
114119

115120

116121
def test_structural_frame_surface_points():
117-
structural_frame: StructuralFrame = test_create_structural_frame()
122+
structural_frame: StructuralFrame = _create_structural_frame()
118123
print(structural_frame.surface_points_copy)
119124
pass
120125

0 commit comments

Comments
 (0)