Base: extend Python wrapper to allow to create a quantity with Units.Quantity(1, 'm') and add a unit test

This commit is contained in:
wmayer
2022-01-21 14:57:49 +01:00
parent 2fef77e267
commit fb84f715fa
2 changed files with 21 additions and 1 deletions

View File

@@ -147,3 +147,8 @@ class UnitBasicCases(unittest.TestCase):
self.failUnless(compare(tu('sin(pi)'), math.sin(math.pi)))
self.failUnless(compare(tu('cos(pi)'), math.cos(math.pi)))
self.failUnless(compare(tu('tan(pi)'), math.tan(math.pi)))
def testQuantity(self):
length = FreeCAD.Units.Quantity(1, "m")
self.assertEqual(length.Value, 1000)
self.assertEqual(length.Unit, FreeCAD.Units.Length)