Skip to content

Commit

Permalink
TESTS: Remove show arg from plot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed May 23, 2024
1 parent 40e6e10 commit fb0cfb7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
5 changes: 2 additions & 3 deletions _unittest/test_02_2D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,14 @@ def test_09_plot(self):
position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", material="Copper"
)
obj = self.aedtapp.plot(
show=False,
export_path=os.path.join(self.local_scratch.path, "image.jpg"),
show_bounding=True,
show_grid=True,
)
assert os.path.exists(obj.image_file)
obj2 = self.aedtapp.plot(show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg"), view="xy")
obj2 = self.aedtapp.plot(export_path=os.path.join(self.local_scratch.path, "image.jpg"), view="xy")
assert os.path.exists(obj2.image_file)
obj3 = self.aedtapp.plot(show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg"), view="xy1")
obj3 = self.aedtapp.plot(export_path=os.path.join(self.local_scratch.path, "image.jpg"), view="xy1")
assert filecmp.cmp(obj.image_file, obj3.image_file)

def test_10_edit_menu_commands(self):
Expand Down
11 changes: 2 additions & 9 deletions _unittest/test_12_1_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def test_01_Animate_plt(self):
intrinsics={"Freq": "5GHz", "Phase": "0deg"},
variation_variable="Phase",
variations=phases,
show=False,
export_gif=True,
export_path=self.local_scratch.path,
)
Expand All @@ -127,7 +126,6 @@ def test_01_Animate_plt(self):
variations=phases,
project_path="",
export_gif=False,
show=False,
)
model_gif2.gif_file = os.path.join(self.aedtapp.working_directory, "test2.gif")
model_gif2.camera_position = [0, 50, 200]
Expand Down Expand Up @@ -514,7 +512,6 @@ def test_14_Field_Ploton_cutplanedesignname(self):
image_format="jpg",
view="xy",
plot_label=plot1.name + " label",
show=False,
)
assert os.path.exists(plot_obj.image_file)
os.unlink(plot_obj.image_file)
Expand All @@ -539,7 +536,6 @@ def test_14_Field_Ploton_cutplanedesignname(self):
image_format="jpg",
view="xy",
plot_label=plot1.name + " label",
show=False,
file_format="aedtplt",
)
assert os.path.exists(plot_obj.image_file)
Expand All @@ -566,20 +562,17 @@ def test_14B_Field_Ploton_Vector(self):
intrinsics=intrinsic,
mesh_on_fields=False,
view="isometric",
show=False,
export_path=self.local_scratch.path,
image_format="jpg",
)
assert os.path.exists(plot_obj.image_file)

@pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="Not running in ironpython")
def test_15_export_plot(self):
obj = self.aedtapp.post.plot_model_obj(
show=False, export_path=os.path.join(self.local_scratch.path, "image.jpg")
)
obj = self.aedtapp.post.plot_model_obj(export_path=os.path.join(self.local_scratch.path, "image.jpg"))
assert os.path.exists(obj.image_file)
obj2 = self.aedtapp.post.plot_model_obj(
show=False, export_path=os.path.join(self.local_scratch.path, "image2.jpg"), plot_as_separate_objects=False
export_path=os.path.join(self.local_scratch.path, "image2.jpg"), plot_as_separate_objects=False
)
assert os.path.exists(obj2.image_file)

Expand Down
19 changes: 5 additions & 14 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,14 @@ def test_55_time_plot(self, sbr_test):
)
assert os.path.exists(frames_list)
sbr_test.post.plot_scene(
frames_list, os.path.join(sbr_test.working_directory, "animation.gif"), norm_index=5, dy_rng=35, show=False
frames_list, os.path.join(sbr_test.working_directory, "animation.gif"), norm_index=5, dy_rng=35
)
assert os.path.exists(os.path.join(sbr_test.working_directory, "animation.gif"))
sbr_test.post.plot_scene(
frames_list,
os.path.join(sbr_test.working_directory, "animation2.gif"),
norm_index=5,
dy_rng=35,
show=False,
convert_fields_in_db=True,
log_multiplier=20.0,
)
Expand Down Expand Up @@ -605,23 +604,22 @@ def test_70_far_field_data(self):
img3 = os.path.join(self.local_scratch.path, "ff_2d2.jpg")
ffdata.plot_2d_cut(image_path=img3)
assert os.path.exists(img3)
curve_2d = ffdata.plot_2d_cut(show=False)
curve_2d = ffdata.plot_2d_cut()
assert len(curve_2d[0]) == 3
data = ffdata.polar_plot_3d(show=False)
data = ffdata.polar_plot_3d()
assert len(data) == 3

img4 = os.path.join(self.local_scratch.path, "ff_3d1.jpg")
ffdata.polar_plot_3d_pyvista(
quantity="RealizedGain",
image_path=img4,
show=False,
background=[255, 0, 0],
show_geometry=False,
convert_to_db=True,
)
assert os.path.exists(img4)
data_pyvista = ffdata.polar_plot_3d_pyvista(
quantity="RealizedGain", show=False, background=[255, 0, 0], show_geometry=False, convert_to_db=True
quantity="RealizedGain", background=[255, 0, 0], show_geometry=False, convert_to_db=True
)
assert data_pyvista

Expand All @@ -637,7 +635,6 @@ def test_71_antenna_plot(self, field_test):
title="Contour at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))

Expand Down Expand Up @@ -667,13 +664,12 @@ def test_71_antenna_plot(self, field_test):
ffdata.polar_plot_3d_pyvista(
quantity="RealizedGain",
image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
show=False,
convert_to_db=True,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))

try:
p = ffdata.polar_plot_3d_pyvista(quantity="RealizedGain", show=False, convert_to_db=True)
p = ffdata.polar_plot_3d_pyvista(quantity="RealizedGain", convert_to_db=True)
assert isinstance(p, object)
except Exception:
assert True
Expand All @@ -687,7 +683,6 @@ def test_72_antenna_plot(self, array_test):
title="Contour at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))

Expand All @@ -697,7 +692,6 @@ def test_72_antenna_plot(self, array_test):
secondary_sweep_value=[-180, -75, 75],
title="Azimuth at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "2d1.jpg"),
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1.jpg"))
ffdata.plot_2d_cut(
Expand All @@ -706,7 +700,6 @@ def test_72_antenna_plot(self, array_test):
secondary_sweep_value=30,
title="Azimuth at {}Hz".format(ffdata.frequency),
image_path=os.path.join(self.local_scratch.path, "2d2.jpg"),
show=False,
)

assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))
Expand All @@ -719,7 +712,6 @@ def test_72_antenna_plot(self, array_test):
ffdata.polar_plot_3d_pyvista(
quantity="RealizedGain",
image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
show=False,
convert_to_db=True,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))
Expand All @@ -729,7 +721,6 @@ def test_72_antenna_plot(self, array_test):
title="Contour at {}Hz".format(ffdata1.frequency),
image_path=os.path.join(self.local_scratch.path, "contour1.jpg"),
convert_to_db=True,
show=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "contour1.jpg"))

Expand Down

0 comments on commit fb0cfb7

Please sign in to comment.