Skip to content

Commit

Permalink
Very minor problem. Test of sheets is impacted by the locale. The dec…
Browse files Browse the repository at this point in the history
…imal 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
  • Loading branch information
plgarcia committed Nov 16, 2017
1 parent 7c1ca8a commit 51f9a67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Mod/Path/PathTests/PathTestUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ def assertCommandEqual(self, c1, c2):
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)

8 changes: 4 additions & 4 deletions src/Mod/Path/PathTests/TestPathSetupSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def test00(self):

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):
Expand Down

0 comments on commit 51f9a67

Please sign in to comment.