diff --git a/_unittest/test_28_Maxwell3D.py b/_unittest/test_28_Maxwell3D.py index 7bfe443d3d7..219fdc43bde 100644 --- a/_unittest/test_28_Maxwell3D.py +++ b/_unittest/test_28_Maxwell3D.py @@ -1,6 +1,7 @@ # Setup paths for module imports from _unittest.conftest import scratch_path, local_path import os +import tempfile # Import required modules from pyaedt import Maxwell3d @@ -99,6 +100,20 @@ def test_07_setup(self): assert Setup.enable() assert self.aedtapp.setup_ctrlprog(Setup.name) + def test_08_setup_ctrlprog_with_file(self): + transient_setup = self.aedtapp.create_setup() + transient_setup.props["MaximumPasses"] = 12 + transient_setup.props["MinimumPasses"] = 2 + transient_setup.props["MinimumConvergedPasses"] = 1 + transient_setup.props["PercentRefinement"] = 30 + transient_setup.props["Frequency"] = "200Hz" + transient_setup.update() + transient_setup.enable_expression_cache(["CoreLoss"], "Fields", "Phase='0deg' ", True) + + # Test the creation of the control program file + with tempfile.TemporaryFile("w+") as fp: + assert self.aedtapp.setup_ctrlprog(transient_setup.name, file_str=fp.name) + def test_22_create_length_mesh(self): assert self.aedtapp.mesh.assign_length_mesh(["Plate"]) diff --git a/_unittest/test_29_Mechanical.py b/_unittest/test_29_Mechanical.py index 2918f09d112..56cac01b90b 100644 --- a/_unittest/test_29_Mechanical.py +++ b/_unittest/test_29_Mechanical.py @@ -90,6 +90,10 @@ def test_07_assign_mechanical_boundaries(self): assert mech.assign_fixed_support(mech.modeler["MyCylinder"].faces[0].id) assert mech.assign_frictionless_support(mech.modeler["MyCylinder"].faces[1].id) + mech = Mechanical(solution_type=self.aedtapp.SOLUTIONS.Mechanical.Thermal) + assert not mech.assign_fixed_support(mech.modeler["MyCylinder"].faces[0].id) + assert not mech.assign_frictionless_support(mech.modeler["MyCylinder"].faces[0].id) + def test_08_mesh_settings(self): assert self.aedtapp.mesh.initial_mesh_settings assert self.aedtapp.mesh.initial_mesh_settings.props diff --git a/_unittest/test_31_Q3D.py b/_unittest/test_31_Q3D.py index 2e4ec2d6b07..64a35ee37df 100644 --- a/_unittest/test_31_Q3D.py +++ b/_unittest/test_31_Q3D.py @@ -53,6 +53,9 @@ def test_06a_create_setup(self): assert sweep assert sweep.props["RangeStart"] == "1GHz" + # Create a discrete sweep with the same name of an existing sweep is not possible. + assert not self.aedtapp.create_discrete_sweep(mysetup.name, sweepname="mysweep", freqstart=1, units="GHz") + def test_06b_create_setup(self): mysetup = self.aedtapp.create_setup() mysetup.props["SaveFields"] = True diff --git a/_unittest/test_41_3dlayout_modeler.py b/_unittest/test_41_3dlayout_modeler.py index 15d52ef881f..84061e60db0 100644 --- a/_unittest/test_41_3dlayout_modeler.py +++ b/_unittest/test_41_3dlayout_modeler.py @@ -292,6 +292,23 @@ def test_18b_create_linear_step_sweep(self): ) assert sweep4.props["Sweeps"]["Data"] == "LIN 1GHz 10GHz 0.12GHz" + # Create a linear step sweep with the incorrect sweep type. + try: + sweep_raising_error = self.aedtapp.create_linear_step_sweep( + setupname=setup_name, + unit="GHz", + freqstart=1, + freqstop=10, + step_size=0.12, + sweepname="RFBoardSweep4", + sweep_type="Incorrect", + save_fields=True, + ) + except AttributeError as e: + exception_raised = True + assert e.args[0] == "Invalid in `sweep_type`. It has to be either 'Discrete', 'Interpolating', or 'Fast'" + assert exception_raised + def test_18c_create_single_point_sweep(self): setup_name = "RFBoardSetup" sweep5 = self.aedtapp.create_single_point_sweep(