Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -17,7 +17,7 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.drawing
class TestAssignProduct(test.bootstrap.IFC4):
@@ -25,16 +25,16 @@ class TestAssignProduct(test.bootstrap.IFC4):
wall = self.file.createIfcWall()
label = self.file.createIfcAnnotation()
label2 = self.file.createIfcAnnotation()
ifcopenshell.api.run("drawing.assign_product", self.file, relating_product=wall, related_object=label)
ifcopenshell.api.drawing.assign_product(self.file, relating_product=wall, related_object=label)
assert wall.ReferencedBy[0].RelatedObjects == (label,)
ifcopenshell.api.run("drawing.assign_product", self.file, relating_product=wall, related_object=label2)
ifcopenshell.api.drawing.assign_product(self.file, relating_product=wall, related_object=label2)
assert wall.ReferencedBy[0].RelatedObjects == (label, label2)
def test_not_assigning_twice(self):
wall = self.file.createIfcWall()
label = self.file.createIfcAnnotation()
ifcopenshell.api.run("drawing.assign_product", self.file, relating_product=wall, related_object=label)
ifcopenshell.api.run("drawing.assign_product", self.file, relating_product=wall, related_object=label)
ifcopenshell.api.drawing.assign_product(self.file, relating_product=wall, related_object=label)
ifcopenshell.api.drawing.assign_product(self.file, relating_product=wall, related_object=label)
assert len(wall.ReferencedBy) == 1
assert wall.ReferencedBy[0].RelatedObjects == (label,)
@@ -17,14 +17,13 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.drawing
class TestEditTextLiteral(test.bootstrap.IFC4):
def test_run(self):
text = self.file.createIfcTextLiteralWithExtent()
ifcopenshell.api.run(
"drawing.edit_text_literal",
ifcopenshell.api.drawing.edit_text_literal(
self.file,
text_literal=text,
attributes={
@@ -17,15 +17,15 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.drawing
class TestUnassignProduct(test.bootstrap.IFC4):
def test_unassigning_a_product(self):
wall = self.file.createIfcWall()
label = self.file.createIfcAnnotation()
ifcopenshell.api.run("drawing.assign_product", self.file, relating_product=wall, related_object=label)
ifcopenshell.api.run("drawing.unassign_product", self.file, relating_product=wall, related_object=label)
ifcopenshell.api.drawing.assign_product(self.file, relating_product=wall, related_object=label)
ifcopenshell.api.drawing.unassign_product(self.file, relating_product=wall, related_object=label)
assert len(self.file.by_type("IfcRelAssignsToProduct")) == 0