mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 12:12:15 +00:00
replace api.run with static methods
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user