mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
library.unassign_reference - support batching #4474
This commit is contained in:
@@ -18,12 +18,20 @@
|
||||
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
|
||||
|
||||
class TestUnassignReference(test.bootstrap.IFC4):
|
||||
def test_unassigning_a_reference(self):
|
||||
reference = self.file.createIfcLibraryReference()
|
||||
product = self.file.createIfcWall()
|
||||
ifcopenshell.api.run("library.assign_reference", self.file, products=[product], reference=reference)
|
||||
ifcopenshell.api.run("library.unassign_reference", self.file, product=product, reference=reference)
|
||||
products = [self.file.createIfcWall() for i in range(3)]
|
||||
ifcopenshell.api.run("library.assign_reference", self.file, products=products, reference=reference)
|
||||
ifcopenshell.api.run("library.unassign_reference", self.file, products=products[:1], reference=reference)
|
||||
assert ifcopenshell.util.element.get_referenced_elements(reference) == set(products[1:])
|
||||
|
||||
ifcopenshell.api.run("library.unassign_reference", self.file, products=products[1:], reference=reference)
|
||||
assert ifcopenshell.util.element.get_referenced_elements(reference) == set()
|
||||
assert len(self.file.by_type("IfcRelAssociatesLibrary")) == 0
|
||||
|
||||
class TestUnassignReferenceIFC2X3(test.bootstrap.IFC2X3, TestUnassignReference):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user