mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user