Fix bug where MergeDuplicateTypesByTag recipe would've left multiple IfcRelDefinesByType relationships which is no good

This commit is contained in:
Dion Moult
2022-08-03 17:33:23 +10:00
parent 0ee93294dd
commit 709c530434
5 changed files with 74 additions and 16 deletions
@@ -40,6 +40,19 @@ class TestAddReference(test.bootstrap.IFC4):
assert references[0].Name == "Foobar"
assert references[0].ReferencedSource == self.file.by_type("IfcClassification")[0]
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
ifcopenshell.api.run(
"classification.add_reference",
self.file,
product=element2,
identification="X",
name="Foobar",
classification=result,
)
assert list(ifcopenshell.util.classification.get_references(element2))[0].Identification == "X"
assert list(ifcopenshell.util.classification.get_references(element2))[0].Name == "Foobar"
assert list(ifcopenshell.util.classification.get_references(element2))[0] == references[0]
def test_adding_a_reference_from_a_library(self):
library = ifcopenshell.file()
classification = library.createIfcClassification(Name="Name")
@@ -36,15 +36,15 @@ class TestPsetQto:
def test_getting_applicables_for_a_specific_predefined_type(self):
names = self.pset_qto.get_applicable_names("IfcAudioVisualAppliance")
assert len(names) == 17
assert len(names) == 12
assert "Pset_AudioVisualApplianceTypeAmplifier" not in names
names = self.pset_qto.get_applicable_names("IfcAudioVisualAppliance", predefined_type="AMPLIFIER")
assert "Pset_AudioVisualApplianceTypeAmplifier" in names
assert len(names) == 18
assert len(names) == 13
def test_getting_a_pset_of_a_type_where_the_type_class_is_not_explicitly_applicable(self):
names = self.pset_qto.get_applicable_names("IfcWall")
assert "Pset_WallCommon" in names
names = self.pset_qto.get_applicable_names("IfcWallType")
assert len(names) == 9
assert len(names) == 5
assert "Pset_WallCommon" in names