mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
add test for util.unit.calculate_unit_scale
This commit is contained in:
@@ -22,6 +22,15 @@ import ifcopenshell.api
|
||||
import ifcopenshell.util.unit as subject
|
||||
|
||||
|
||||
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")
|
||||
length.ConversionFactor.UnitComponent.Prefix = "MILLI"
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file, units=[length])
|
||||
assert subject.calculate_unit_scale(self.file) == 0.3048 * 0.001
|
||||
|
||||
|
||||
class TestFormatLength(test.bootstrap.IFC4):
|
||||
def test_run(self):
|
||||
assert subject.format_length(1, 1, decimal_places=0, unit_system="metric") == "1"
|
||||
|
||||
Reference in New Issue
Block a user