replace api.run with static methods

This commit is contained in:
Andrej
2025-06-09 10:59:22 +05:00
parent 02d359d0e6
commit 8b4683aef1
122 changed files with 1334 additions and 1370 deletions
@@ -26,15 +26,18 @@ TEST_FILE = Path(__file__).parent / "files" / "basic.ifc"
class TestFile:
def test_run(self):
stream_file: ifcopenshell.stream
stream_file = ifcopenshell.open(TEST_FILE, should_stream=True)
assert stream_file.schema == "IFC4"
def test_by_id(self):
stream_file: ifcopenshell.stream
stream_file = ifcopenshell.open(TEST_FILE, should_stream=True)
assert (element := stream_file.by_id(1))
assert str(element) == "#1=IFCPROJECT('3kv235yMjDO9tHiTzD8QuS',$,'My Project',$,$,$,$,(#14,#26),#9);"
def test_by_type(self):
stream_file: ifcopenshell.stream
stream_file = ifcopenshell.open(TEST_FILE, should_stream=True)
assert (elements := stream_file.by_type("IfcProject"))
assert str(elements[0]) == "#1=IFCPROJECT('3kv235yMjDO9tHiTzD8QuS',$,'My Project',$,$,$,$,(#14,#26),#9);"
@@ -42,6 +45,7 @@ class TestFile:
class TestEntity:
def test_getattr(self):
stream_file: ifcopenshell.stream
stream_file = ifcopenshell.open(TEST_FILE, should_stream=True)
assert (element := stream_file.by_id(1))
assert element.Name == "My Project"