From 7ca5ba14b5638eeff93d00996c00cb153a35d062 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 7 Jun 2021 15:31:41 +1000 Subject: [PATCH] Cleanup: use keywords for unit tests Prepare for function calls to be keyword only. --- tests/python/bl_pyapi_bpy_utils_units.py | 4 ++-- tests/python/bl_pyapi_mathutils.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/python/bl_pyapi_bpy_utils_units.py b/tests/python/bl_pyapi_bpy_utils_units.py index d5d9c9c707b..bdb64fc361e 100644 --- a/tests/python/bl_pyapi_bpy_utils_units.py +++ b/tests/python/bl_pyapi_bpy_utils_units.py @@ -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=( diff --git a/tests/python/bl_pyapi_mathutils.py b/tests/python/bl_pyapi_mathutils.py index 914b1689a5c..c3a22be421a 100644 --- a/tests/python/bl_pyapi_mathutils.py +++ b/tests/python/bl_pyapi_mathutils.py @@ -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):