Cleanup: use keywords for unit tests

Prepare for function calls to be keyword only.
This commit is contained in:
Campbell Barton 2021-06-07 15:31:41 +10:00
parent 51bf1680bd
commit 7ca5ba14b5
2 changed files with 6 additions and 6 deletions

@ -54,7 +54,7 @@ class UnitsTesting(unittest.TestCase):
return ((abs(v1 - v2) / max(abs(v1), abs(v2))) <= e)
for usys, utype, ref, inpt, val in self.INPUT_TESTS:
opt_val = units.to_value(usys, utype, inpt, ref)
opt_val = units.to_value(usys, utype, inpt, str_ref_unit=ref)
# Note: almostequal is not good here, precision is fixed on decimal digits, not variable with
# magnitude of numbers (i.e. 1609.4416 ~= 1609.4456 fails even at 5 of 'places'...).
self.assertTrue(similar_values(opt_val, val, 1e-7),
@ -63,7 +63,7 @@ class UnitsTesting(unittest.TestCase):
def test_units_outputs(self):
for usys, utype, prec, sep, compat, val, output in self.OUTPUT_TESTS:
opt_str = units.to_string(usys, utype, val, prec, sep, compat)
opt_str = units.to_string(usys, utype, val, precision=prec, split_unit=sep, compatible_unit=compat)
self.assertEqual(
opt_str, output,
msg=(

@ -463,20 +463,20 @@ class KDTreeTesting(unittest.TestCase):
ret_regular = k_odd.find(co)
self.assertEqual(ret_regular[1] % 2, 1)
ret_filter = k_all.find(co, lambda i: (i % 2) == 1)
ret_filter = k_all.find(co, filter=lambda i: (i % 2) == 1)
self.assertAlmostEqualVector(ret_regular, ret_filter)
ret_regular = k_evn.find(co)
self.assertEqual(ret_regular[1] % 2, 0)
ret_filter = k_all.find(co, lambda i: (i % 2) == 0)
ret_filter = k_all.find(co, filter=lambda i: (i % 2) == 0)
self.assertAlmostEqualVector(ret_regular, ret_filter)
# filter out all values (search odd tree for even values and the reverse)
co = (0,) * 3
ret_filter = k_odd.find(co, lambda i: (i % 2) == 0)
ret_filter = k_odd.find(co, filter=lambda i: (i % 2) == 0)
self.assertEqual(ret_filter[1], None)
ret_filter = k_evn.find(co, lambda i: (i % 2) == 1)
ret_filter = k_evn.find(co, filter=lambda i: (i % 2) == 1)
self.assertEqual(ret_filter[1], None)
def test_kdtree_invalid_size(self):