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
@@ -18,19 +18,19 @@
import pytest
import test.bootstrap
import ifcopenshell.api
import ifcopenshell.api.style
class TestRemoveSurfaceStyleIFC2X3(test.bootstrap.IFC2X3):
def test_removing_a_shading_style(self):
style = self.file.createIfcSurfaceStyleShading(SurfaceColour=self.file.createIfcColourRgb(None, 1, 1, 1))
ifcopenshell.api.run("style.remove_surface_style", self.file, style=style)
ifcopenshell.api.style.remove_surface_style(self.file, style=style)
assert len(list(self.file)) == 0
def test_removing_a_texture_style(self):
texture = self.file.createIfcImageTexture()
style = self.file.createIfcSurfaceStyleWithTextures(Textures=[texture])
ifcopenshell.api.run("style.remove_surface_style", self.file, style=style)
ifcopenshell.api.style.remove_surface_style(self.file, style=style)
assert len(list(self.file)) == 0
def test_removing_a_rendering_style(self):
@@ -46,7 +46,7 @@ class TestRemoveSurfaceStyleIFC2X3(test.bootstrap.IFC2X3):
# remove entity_instances() without an ID if we create them afresh, but
# will segfault if we load them stale.
g = ifcopenshell.file.from_string(self.file.wrapped_data.to_string())
ifcopenshell.api.run("style.remove_surface_style", g, style=g.by_type("IfcSurfaceStyleRendering")[0])
ifcopenshell.api.style.remove_surface_style(g, style=g.by_type("IfcSurfaceStyleRendering")[0])
assert len(list(g)) == 0
@@ -56,5 +56,5 @@ class TestRemoveSurfaceStyleIFC4(test.bootstrap.IFC4, TestRemoveSurfaceStyleIFC2
texture = self.file.createIfcImageTexture()
coordinates = self.file.createIfcTextureCoordinateGenerator(Maps=[texture])
style = self.file.createIfcSurfaceStyleWithTextures(Textures=[texture])
ifcopenshell.api.run("style.remove_surface_style", self.file, style=style)
ifcopenshell.api.style.remove_surface_style(self.file, style=style)
assert len(list(self.file)) == 0