mirror of
https://github.com/inventree/InvenTree.git
synced 2026-06-06 08:54:24 +00:00
@@ -114,6 +114,9 @@ def reload_unit_registry():
|
|||||||
reg.define('@alias degF = Fahrenheit')
|
reg.define('@alias degF = Fahrenheit')
|
||||||
reg.define('@alias degK = Kelvin')
|
reg.define('@alias degK = Kelvin')
|
||||||
|
|
||||||
|
# Override R as ohm (pint defines R as an SI prefix by default)
|
||||||
|
reg.define('R = ohm')
|
||||||
|
|
||||||
# Define some "standard" additional units
|
# Define some "standard" additional units
|
||||||
reg.define('piece = 1')
|
reg.define('piece = 1')
|
||||||
reg.define('each = 1 = ea')
|
reg.define('each = 1 = ea')
|
||||||
|
|||||||
@@ -293,6 +293,16 @@ class ConversionTest(TestCase):
|
|||||||
)
|
)
|
||||||
self.assertAlmostEqual(output, expected, 12)
|
self.assertAlmostEqual(output, expected, 12)
|
||||||
|
|
||||||
|
# Test that 'R' is interpreted as ohms
|
||||||
|
# Ref: https://github.com/inventree/InvenTree/issues/12063
|
||||||
|
r_tests = [('8R6', 8.6), ('10R', 10), ('4R7', 4.7), ('100R', 100)]
|
||||||
|
|
||||||
|
for val, expected in r_tests:
|
||||||
|
output = InvenTree.conversion.convert_physical_value(
|
||||||
|
val, 'ohm', strip_units=True
|
||||||
|
)
|
||||||
|
self.assertAlmostEqual(output, expected, 6)
|
||||||
|
|
||||||
def test_scientific_notation(self):
|
def test_scientific_notation(self):
|
||||||
"""Test that scientific notation is handled correctly."""
|
"""Test that scientific notation is handled correctly."""
|
||||||
tests = [
|
tests = [
|
||||||
|
|||||||
Reference in New Issue
Block a user