Skip to content

Commit 5449efa

Browse files
committed
Updated the tests for numpy 2
1 parent c2fa9db commit 5449efa

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

test/python3/test_binder_python.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -381,22 +381,22 @@ def test_values():
381381
array = c3d["data"]["points"]
382382
decimal = 6
383383

384-
np.testing.assert_array_equal(x=array.shape, y=(4, 51, 580), err_msg="Shape does not match")
384+
np.testing.assert_array_equal(actual=array.shape, desired=(4, 51, 580), err_msg="Shape does not match")
385385
raveled = array.ravel()
386386
np.testing.assert_array_almost_equal(
387-
x=raveled[0],
388-
y=44.16278839111328,
387+
actual=raveled[0],
388+
desired=44.16278839111328,
389389
decimal=decimal,
390390
)
391391
np.testing.assert_array_almost_equal(
392-
x=raveled[-1],
393-
y=1.0,
392+
actual=raveled[-1],
393+
desired=1.0,
394394
decimal=decimal,
395395
)
396-
np.testing.assert_array_almost_equal(x=np.nanmean(array), y=362.2979849093196, decimal=decimal)
397-
np.testing.assert_array_almost_equal(x=np.nanmedian(array), y=337.7519226074219, decimal=decimal)
396+
np.testing.assert_array_almost_equal(actual=np.nanmean(array), desired=362.2979849093196, decimal=decimal)
397+
np.testing.assert_array_almost_equal(actual=np.nanmedian(array), desired=337.7519226074219, decimal=decimal)
398398
np.testing.assert_allclose(actual=np.nansum(array), desired=42535594.91827867, rtol=0.05)
399-
np.testing.assert_array_equal(x=np.isnan(array).sum(), y=915)
399+
np.testing.assert_array_equal(actual=np.isnan(array).sum(), desired=915)
400400

401401

402402
def test_force_platform_filter():
@@ -465,19 +465,19 @@ def test_rotations():
465465
array = c3d["data"]["rotations"]
466466
decimal = 6
467467

468-
np.testing.assert_array_equal(x=array.shape, y=(4, 4, 21, 340), err_msg="Shape does not match")
468+
np.testing.assert_array_equal(actual=array.shape, desired=(4, 4, 21, 340), err_msg="Shape does not match")
469469
raveled = array.ravel()
470470
np.testing.assert_array_almost_equal(
471-
x=array[2, 3, 2, 5],
472-
y=931.6382446289062,
471+
actual=array[2, 3, 2, 5],
472+
desired=931.6382446289062,
473473
decimal=decimal,
474474
)
475475
np.testing.assert_array_almost_equal(
476-
x=raveled[-1],
477-
y=1.0,
476+
actual=raveled[-1],
477+
desired=1.0,
478478
decimal=decimal,
479479
)
480-
np.testing.assert_array_almost_equal(x=np.nansum(array), y=9367125.137371363, decimal=decimal)
480+
np.testing.assert_array_almost_equal(actual=np.nansum(array), desired=9367125.137371363, decimal=decimal)
481481

482482

483483
@pytest.fixture(scope="module", params=["BTS", "Optotrak", "Qualisys", "Vicon", "Label2"])
@@ -540,10 +540,13 @@ def test_parse_and_rebuild_parameters(c3d_build_rebuild_reduced):
540540
continue
541541

542542
try:
543+
if orig.parameters[group_key][param_key]['type'] != rebuilt.parameters[group_key][param_key]['type']:
544+
print(f"Type mismatch for {group_key} - {param_key} ")
545+
543546
assert orig.parameters[group_key][param_key]['type'] == rebuilt.parameters[group_key][param_key]['type']
544547
except:
545548
# Type may differ for empty values
546-
if not orig.parameters[group_key][param_key]['value'] and not rebuilt.parameters[group_key][param_key]['value']:
549+
if orig.parameters[group_key][param_key]['value'].any() == rebuilt.parameters[group_key][param_key]['value'].any() == False:
547550
pass
548551
else:
549552
assert orig.parameters[group_key][param_key]['type'] == rebuilt.parameters[group_key][param_key]['type']

0 commit comments

Comments
 (0)