Skip to content

Commit

Permalink
FIX: Defining Modelithics attributes change (#5233)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin4667 authored Oct 4, 2024
1 parent c71c824 commit 08db6d0
Showing 1 changed file with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ class TestClass:
def test_modelithics_inductor_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_inductor_list_count == 116

def test_modelithics_inductor_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_list(-1)
assert info.value.args[0] == "The Modelithics inductor at the given index is not available"
Expand All @@ -64,6 +72,10 @@ def test_modelithics_inductor_list(self):
def test_modelithics_inductor_selection(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_selection
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_selection
assert info.value.args[0] == "No Modelithics inductor is selected"
Expand All @@ -73,6 +85,10 @@ def test_modelithics_inductor_selection(self):
def test_modelithics_inductor_family_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_family_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_inductor_family_list_count == 0
lumpdesign.export_to_aedt.modelithics_inductor_add_family(second_modelithics_inductor)
assert lumpdesign.export_to_aedt.modelithics_inductor_family_list_count == 1
Expand All @@ -82,6 +98,10 @@ def test_modelithics_inductor_family_list_count(self):
def test_modelithics_inductor_family_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_family_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_family_list(0)
assert info.value.args[0] == "The Modelithics inductor family at the given index is not available"
Expand All @@ -93,6 +113,10 @@ def test_modelithics_inductor_family_list(self):
def test_modelithics_inductor_family_list_add_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_add_family(second_modelithics_inductor)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_family_list(0)
assert info.value.args[0] == "The Modelithics inductor family at the given index is not available"
Expand All @@ -104,6 +128,9 @@ def test_modelithics_inductor_family_list_add_family(self):
def test_modelithics_inductor_family_list_remove_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_remove_family(second_modelithics_inductor)
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_inductor_family_list(0)
assert info.value.args[0] == "The Modelithics inductor family at the given index is not available"
Expand All @@ -116,11 +143,19 @@ def test_modelithics_inductor_family_list_remove_family(self):
def test_modelithics_capacitor_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
assert lumpdesign.export_to_aedt.modelithics_capacitor_list_count == 140
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_capacitor_list_count == 143

def test_modelithics_capacitor_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_list(-1)
assert info.value.args[0] == "The Modelithics capacitor at the given index is not available"
Expand All @@ -130,6 +165,10 @@ def test_modelithics_capacitor_list(self):
def test_modelithics_capacitor_selection(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_selection
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_selection
assert info.value.args[0] == "No Modelithics capacitor is selected"
Expand All @@ -139,6 +178,10 @@ def test_modelithics_capacitor_selection(self):
def test_modelithics_capacitor_family_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_family_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_capacitor_family_list_count == 0
lumpdesign.export_to_aedt.modelithics_capacitor_add_family(first_modelithics_capacitor)
assert lumpdesign.export_to_aedt.modelithics_capacitor_family_list_count == 1
Expand All @@ -148,6 +191,10 @@ def test_modelithics_capacitor_family_list_count(self):
def test_modelithics_capacitor_family_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_family_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_family_list(0)
assert info.value.args[0] == "The Modelithics capacitor family at the given index is not available"
Expand All @@ -159,6 +206,10 @@ def test_modelithics_capacitor_family_list(self):
def test_modelithics_capacitor_family_list_add_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_add_family(first_modelithics_capacitor)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_family_list(0)
assert info.value.args[0] == "The Modelithics capacitor family at the given index is not available"
Expand All @@ -170,6 +221,10 @@ def test_modelithics_capacitor_family_list_add_family(self):
def test_modelithics_capacitor_family_list_remove_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_remove_family(second_modelithics_capacitor)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_capacitor_family_list(0)
assert info.value.args[0] == "The Modelithics capacitor family at the given index is not available"
Expand All @@ -182,11 +237,19 @@ def test_modelithics_capacitor_family_list_remove_family(self):
def test_modelithics_resistor_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_resistor_list_count == 39

def test_modelithics_resistor_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_list(-1)
assert info.value.args[0] == "The Modelithics resistor at the given index is not available"
Expand All @@ -196,6 +259,10 @@ def test_modelithics_resistor_list(self):
def test_modelithics_resistor_selection(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_selection
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_selection
assert info.value.args[0] == "No Modelithics resistor is selected"
Expand All @@ -205,6 +272,10 @@ def test_modelithics_resistor_selection(self):
def test_modelithics_resistor_family_list_count(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_family_list_count
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
assert lumpdesign.export_to_aedt.modelithics_resistor_family_list_count == 0
lumpdesign.export_to_aedt.modelithics_resistor_add_family(first_modelithics_resistor)
assert lumpdesign.export_to_aedt.modelithics_resistor_family_list_count == 1
Expand All @@ -214,6 +285,10 @@ def test_modelithics_resistor_family_list_count(self):
def test_modelithics_resistor_family_list(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_family_list(0)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_family_list(0)
assert info.value.args[0] == "The Modelithics resistor family at the given index is not available"
Expand All @@ -225,6 +300,10 @@ def test_modelithics_resistor_family_list(self):
def test_modelithics_resistor_family_list_add_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_add_family(first_modelithics_resistor)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_family_list(0)
assert info.value.args[0] == "The Modelithics resistor family at the given index is not available"
Expand All @@ -236,6 +315,10 @@ def test_modelithics_resistor_family_list_add_family(self):
def test_modelithics_resistor_family_list_remove_family(self):
lumpdesign = ansys.aedt.core.FilterSolutions(implementation_type=FilterImplementation.LUMPED)
lumpdesign.export_to_aedt._open_aedt_export()
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_remove_family(second_modelithics_resistor)
assert info.value.args[0] == "The part library is not set to Modelithics"
lumpdesign.export_to_aedt.part_libraries = PartLibraries.MODELITHICS
with pytest.raises(RuntimeError) as info:
lumpdesign.export_to_aedt.modelithics_resistor_family_list(0)
assert info.value.args[0] == "The Modelithics resistor family at the given index is not available"
Expand Down

0 comments on commit 08db6d0

Please sign in to comment.