Very minor problem. Test of sheets is impacted by the locale. The decimal separator may be , instead of .

An assertEqualLocale function has been added to replace , by . in the values impacted by the locale with before comparison with the expected string containing a . as decimal separator.

Works fine
This commit is contained in:
plgarcia
2017-11-18 22:04:57 +01:00
parent f1f2a90190
commit da79e1ff86
2 changed files with 9 additions and 4 deletions

View File

@@ -127,3 +127,8 @@ class PathTestBase(unittest.TestCase):
self.assertRoughly(c1.Parameters.get('I', 0), c2.Parameters.get('I', 0))
self.assertRoughly(c1.Parameters.get('J', 0), c2.Parameters.get('J', 0))
self.assertRoughly(c1.Parameters.get('K', 0), c2.Parameters.get('K', 0))
def assertEqualLocale(self,s1,s2):
"""Verify that the 2 strings are equivalent, but converts eventual , into . for the first string that may be affected by locale."""
self.assertEqual(s1.replace(",","."), s2)

View File

@@ -53,11 +53,11 @@ class TestPathSetupSheet(PathTestBase):
attrs = ss.templateAttributes(True, True)
self.assertEqual(attrs[PathSetupSheet.Template.HorizRapid], '0.00 mm/s')
self.assertEqual(attrs[PathSetupSheet.Template.VertRapid], '0.00 mm/s')
self.assertEqual(attrs[PathSetupSheet.Template.SafeHeightOffset], '3.00 mm')
self.assertEqualLocale(attrs[PathSetupSheet.Template.HorizRapid], '0.00 mm/s')
self.assertEqualLocale(attrs[PathSetupSheet.Template.VertRapid], '0.00 mm/s')
self.assertEqualLocale(attrs[PathSetupSheet.Template.SafeHeightOffset], '3.00 mm')
self.assertEqual(attrs[PathSetupSheet.Template.SafeHeightExpression], 'StartDepth+SetupSheet.SafeHeightOffset')
self.assertEqual(attrs[PathSetupSheet.Template.ClearanceHeightOffset], '5.00 mm')
self.assertEqualLocale(attrs[PathSetupSheet.Template.ClearanceHeightOffset], '5.00 mm')
self.assertEqual(attrs[PathSetupSheet.Template.ClearanceHeightExpression], 'StartDepth+SetupSheet.ClearanceHeightOffset')
def test01(self):