mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
unify tests for ifc4 and ifc2x3
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user