Skip to content

Commit

Permalink
Remove rogue prints from tests (#449)
Browse files Browse the repository at this point in the history
* Remove rogue prints from test

* remove progress bars from test_selection.py

* Add explicit test of FluidSimulation.__str__()
  • Loading branch information
PProfizi authored Aug 1, 2023
1 parent 225b8ed commit 60da6a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/test_fluid_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ def cfx_simulation(self):
)
return post.FluidSimulation(ds) # noqa

def test_simulation_init(self, fluent_simulation):
def test_simulation_str(self, fluent_simulation):
assert fluent_simulation is not None
assert str(fluent_simulation)

@pytest.mark.parametrize(
"result_name",
Expand Down Expand Up @@ -110,12 +111,12 @@ def test_fluid_simulation_phases(self, fluent_simulation):
assert isinstance(fluent_simulation.phases, PhasesDict)

def test_fluid_simulation_result_unavailable(self, fluent_simulation):
print(fluent_simulation)
# print(fluent_simulation)
with pytest.raises(ValueError, match="is not available."):
_ = fluent_simulation.wall_shear_stress()

def test_results_fluent_averaging_from_elemental(self, fluent_simulation):
print(fluent_simulation)
# print(fluent_simulation)
# ######## Elemental Result #################
# Request on None
result = fluent_simulation.enthalpy()
Expand Down Expand Up @@ -145,7 +146,7 @@ def test_results_fluent_averaging_from_elemental(self, fluent_simulation):
assert result._core_object[0].location == post.locations.elemental

def test_results_fluent_averaging_from_elemental_faces(self, fluent_simulation):
print(fluent_simulation)
# print(fluent_simulation)
# ######## ElementalFaces Result #################
# Request on None
result = fluent_simulation.static_pressure()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mesh_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def fluent_simulation(self):
return post.FluidSimulation(ds) # noqa

def test_fluid_mesh_info_print(self, fluent_simulation):
print(fluent_simulation.mesh_info)
# print(fluent_simulation.mesh_info)
ref = (
"Fluid mesh metadata\n"
"-------------------\n"
Expand Down
6 changes: 6 additions & 0 deletions tests/test_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
def test_spatial_selection_select_nodes(allkindofcomplexity):
simulation = post.load_simulation(allkindofcomplexity)
selection = SpatialSelection()
selection._selection.progress_bar = False
selection.select_nodes([1, 2, 3])
scoping = selection._evaluate_on(simulation)
assert scoping.location == post.locations.nodal
Expand All @@ -21,6 +22,7 @@ def test_spatial_selection_select_nodes(allkindofcomplexity):
def test_spatial_selection_select_elements(allkindofcomplexity):
simulation = post.load_simulation(allkindofcomplexity)
selection = SpatialSelection()
selection._selection.progress_bar = False
selection.select_elements([1, 2, 3, 4])
scoping = selection._evaluate_on(simulation)
assert scoping.location == post.locations.elemental
Expand All @@ -32,6 +34,7 @@ def test_spatial_selection_select_elements(allkindofcomplexity):
def test_spatial_selection_select_named_selection(allkindofcomplexity):
simulation = post.load_simulation(allkindofcomplexity)
selection = SpatialSelection()
selection._selection.progress_bar = False
selection.select_named_selection(
simulation.mesh.named_selections.keys()[0],
location=post.selection.locations.nodal,
Expand Down Expand Up @@ -68,13 +71,15 @@ def fluent_simulation(self):

def test_spatial_selection_select_faces(self, fluent_simulation):
selection = SpatialSelection()
selection._selection.progress_bar = False
selection.select_faces(fluent_simulation.mesh.face_ids)
scoping = selection._evaluate_on(fluent_simulation)
assert scoping.location == post.locations.faces
assert np.allclose(scoping.ids, fluent_simulation.mesh.face_ids)

def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation):
selection = SpatialSelection()
selection._selection.progress_bar = False
face_0 = fluent_simulation.mesh.faces[0]
selection.select_nodes_of_faces(
faces=[face_0.id],
Expand All @@ -86,6 +91,7 @@ def test_spatial_selection_select_nodes_of_faces(self, fluent_simulation):

def test_spatial_selection_select_faces_of_elements(self, fluent_simulation):
selection = SpatialSelection()
selection._selection.progress_bar = False
elem_0 = fluent_simulation.mesh.elements[0]
selection.select_faces_of_elements(
elements=[elem_0.id],
Expand Down

0 comments on commit 60da6a2

Please sign in to comment.