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
+4 -3
View File
@@ -19,13 +19,14 @@
import pytest
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.project
import ifcopenshell.api.owner.settings
class IFC4X3:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file", version="IFC4X3")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file(version="IFC4X3")
ifcopenshell.api.owner.settings.get_user = lambda ifc: (ifc.by_type("IfcPersonAndOrganization") or [None])[0]
ifcopenshell.api.owner.settings.get_application = lambda ifc: (ifc.by_type("IfcApplication") or [None])[0]
ifcopenshell.api.pre_listeners = {}
@@ -35,7 +36,7 @@ class IFC4X3:
class IFC4:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file()
ifcopenshell.api.owner.settings.get_user = lambda ifc: (ifc.by_type("IfcPersonAndOrganization") or [None])[0]
ifcopenshell.api.owner.settings.get_application = lambda ifc: (ifc.by_type("IfcApplication") or [None])[0]
ifcopenshell.api.pre_listeners = {}
@@ -45,7 +46,7 @@ class IFC4:
class IFC2X3:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file", version="IFC2X3")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file(version="IFC2X3")
def get_user(ifc_file: ifcopenshell.file) -> ifcopenshell.entity_instance:
person = ifcopenshell.api.owner.add_person(ifc_file)