mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
fix test_number_formatting tests and add cases (#7332)
This commit is contained in:
committed by
GitHub
parent
25d3edc537
commit
b8adddc648
@@ -259,6 +259,7 @@ class FormatTransformer(lark.Transformer):
|
||||
)
|
||||
|
||||
def imperial_length(self, args):
|
||||
args = list(filter(lambda x: x is not None, args))
|
||||
if len(args) == 2:
|
||||
input_unit, output_unit = "foot", "foot"
|
||||
value, precision = args
|
||||
@@ -279,7 +280,7 @@ class FormatTransformer(lark.Transformer):
|
||||
return ifcopenshell.util.unit.format_length(
|
||||
float(value),
|
||||
int(precision),
|
||||
suppress_zero_inches=suppress_zero_inches,
|
||||
suppress_zero_inches=(suppress_zero_inches if suppress_zero_inches is not None else False),
|
||||
unit_system="imperial",
|
||||
input_unit=input_unit,
|
||||
output_unit=output_unit,
|
||||
|
||||
@@ -73,6 +73,10 @@ class TestFormat:
|
||||
assert subject.format('imperial_length("3.123", 2)') == "3' - 1 1/2\""
|
||||
assert subject.format('imperial_length("123.123", 2, "inch", "foot")') == "10' - 3\""
|
||||
assert subject.format('imperial_length("123.123", 2, "inch", "inch")') == '123"'
|
||||
assert subject.format('imperial_length(3.0, 4, "foot", "foot", true)') == "3'"
|
||||
assert subject.format('imperial_length(3.0, 4, "foot", "foot", True)') == "3'"
|
||||
assert subject.format('imperial_length(3.0, 4, "foot", "foot", false)') == "3' - 0\""
|
||||
assert subject.format('imperial_length(3.0, 4, "foot", "foot", False)') == "3' - 0\""
|
||||
|
||||
|
||||
class TestGetElementValue(test.bootstrap.IFC4):
|
||||
|
||||
Reference in New Issue
Block a user