Forgot to commit tests

This commit is contained in:
Dion Moult
2021-10-03 11:47:38 +11:00
committed by Thomas Krijnen
parent adf784236c
commit 808ae37c66
+33
View File
@@ -203,6 +203,39 @@ class TestFile(test.bootstrap.IFC4):
self.file.remove(element)
assert len(list(self.file)) == 0
def test_removing_an_element_and_its_references_are_cleared(self):
history = self.file.createIfcOwnerHistory()
element = self.file.createIfcWall(GlobalId="global_id", OwnerHistory=history)
self.file.remove(history)
assert element.OwnerHistory is None
def test_removing_an_element_and_its_references_are_cleared_regardless_of_cardinality(self):
wall = self.file.createIfcWall(GlobalId="global_id")
rel = self.file.createIfcRelAggregates(RelatingObject=wall)
self.file.remove(wall)
assert rel.RelatingObject == None
def test_removing_an_element_and_its_aggregate_references_are_modified(self):
person = self.file.createIfcPerson()
role = self.file.createIfcActorRole()
role2 = self.file.createIfcActorRole()
person.Roles = [role, role2]
self.file.remove(role)
assert person.Roles == (role2,)
def test_removing_an_element_and_optional_empty_aggregate_references_are_set_to_null(self):
person = self.file.createIfcPerson()
role = self.file.createIfcActorRole()
person.Roles = [role]
self.file.remove(role)
assert person.Roles is None
def test_removing_an_element_and_mandatory_empty_aggregate_references_remain_regardless_of_cardinality(self):
wall = self.file.createIfcWall(GlobalId="global_id")
rel = self.file.createIfcRelAggregates(RelatedObjects=[wall])
self.file.remove(wall)
assert rel.RelatedObjects == tuple()
def test_batched_removing_an_element(self):
element = self.file.createIfcWall(GlobalId="global_id")
self.file.batch()