mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.api.root
|
||||
import ifcopenshell.util.unit as subject
|
||||
from math import pi
|
||||
|
||||
@@ -34,15 +35,15 @@ class TestConvert(test.bootstrap.IFC4):
|
||||
|
||||
class TestCalculateUnitScale(test.bootstrap.IFC4):
|
||||
def test_prefix_and_conversion_based_units_are_considered(self):
|
||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||
length = ifcopenshell.api.run("unit.add_conversion_based_unit", self.file, name="foot")
|
||||
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
|
||||
length = ifcopenshell.api.unit.add_conversion_based_unit(self.file, name="foot")
|
||||
length.ConversionFactor.UnitComponent.Prefix = "MILLI"
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[length])
|
||||
ifcopenshell.api.unit.assign_unit(self.file, units=[length])
|
||||
assert subject.calculate_unit_scale(self.file) == 0.3048 * 0.001
|
||||
|
||||
angle = ifcopenshell.api.run("unit.add_conversion_based_unit", self.file, name="degree")
|
||||
angle = ifcopenshell.api.unit.add_conversion_based_unit(self.file, name="degree")
|
||||
angle.ConversionFactor.UnitComponent.Prefix = "MILLI"
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[angle])
|
||||
ifcopenshell.api.unit.assign_unit(self.file, units=[angle])
|
||||
assert subject.calculate_unit_scale(self.file, "PLANEANGLEUNIT") == pi / 180 * 0.001
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user