unify tests for ifc4 and ifc2x3

This commit is contained in:
Andrej730
2024-04-10 16:26:48 +05:00
parent c2840d92c2
commit 90bb2f0e16
6 changed files with 52 additions and 134 deletions
@@ -32,19 +32,9 @@ class TestAddReference(test.bootstrap.IFC4):
element = ifcopenshell.api.run("document.add_reference", self.file, information=information)
assert element.is_a("IfcDocumentReference")
assert len(self.file.by_type("IfcDocumentReference")) == 1
assert element.ReferencedDocument == information
ifc2x3 = self.file.schema == "IFC2X3"
assert (element.ReferenceToDocument[0] if ifc2x3 else element.ReferencedDocument) == information
class TestAddReferenceIFC2X3(test.bootstrap.IFC2X3):
def test_adding_a_reference(self):
element = ifcopenshell.api.run("document.add_reference", self.file, information=None)
assert element.is_a("IfcDocumentReference")
assert len(self.file.by_type("IfcDocumentReference")) == 1
def test_adding_a_reference_to_an_information(self):
self.file.createIfcProject()
information = ifcopenshell.api.run("document.add_information", self.file, parent=None)
element = ifcopenshell.api.run("document.add_reference", self.file, information=information)
assert element.is_a("IfcDocumentReference")
assert len(self.file.by_type("IfcDocumentReference")) == 1
assert element.ReferenceToDocument[0] == information
class TestAddReferenceIFC2X3(test.bootstrap.IFC2X3, TestAddReference):
pass