From 4bfb237e3cb9afebf6b2b3d058175560d98d0c6e Mon Sep 17 00:00:00 2001 From: lochhh Date: Wed, 7 Aug 2024 11:26:29 +0100 Subject: [PATCH] Remove wrappers around `ds.rename` and `ds.drop_vars` in `conftest.py` --- tests/conftest.py | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index cfb9db19e..77c8c73ec 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -390,16 +390,6 @@ def valid_poses_dataset_with_nan(valid_poses_dataset): return valid_poses_dataset -def rename_dimension_in_ds(valid_dataset, map_old_to_new): - """Return an invalid dataset with one dimension renamed.""" - return valid_dataset.rename(map_old_to_new) - - -def drop_position_var_in_ds(valid_dataset, var_name: str | list): - """Return an invalid dataset without one or more data variable arrays.""" - return valid_dataset.drop_vars(var_name) - - @pytest.fixture def not_a_dataset(): """Return data that is not a pose tracks dataset.""" @@ -415,45 +405,37 @@ def empty_dataset(): @pytest.fixture def missing_var_poses_dataset(valid_poses_dataset): """Return a poses dataset missing position variable.""" - return drop_position_var_in_ds(valid_poses_dataset, var_name="position") + return valid_poses_dataset.drop_vars("position") @pytest.fixture def missing_var_bboxes_dataset(valid_bboxes_dataset): """Return a bboxes dataset missing position variable.""" - return drop_position_var_in_ds(valid_bboxes_dataset, var_name="position") + return valid_bboxes_dataset.drop_vars("position") @pytest.fixture def missing_two_vars_bboxes_dataset(valid_bboxes_dataset): """Return a bboxes dataset missing position and shape variables.""" - return drop_position_var_in_ds( - valid_bboxes_dataset, var_name=["position", "shape"] - ) + return valid_bboxes_dataset.drop_vars(["position", "shape"]) @pytest.fixture def missing_dim_poses_dataset(valid_poses_dataset): """Return a poses dataset missing the time dimension.""" - return rename_dimension_in_ds( - valid_poses_dataset, map_old_to_new={"time": "tame"} - ) + return valid_poses_dataset.rename({"time": "tame"}) @pytest.fixture def missing_dim_bboxes_dataset(valid_bboxes_dataset): """Return a bboxes dataset missing the time dimension.""" - return rename_dimension_in_ds( - valid_bboxes_dataset, map_old_to_new={"time": "tame"} - ) + return valid_bboxes_dataset.rename({"time": "tame"}) @pytest.fixture def missing_two_dims_bboxes_dataset(valid_bboxes_dataset): """Return a bboxes dataset missing the time and space dimensions.""" - return rename_dimension_in_ds( - valid_bboxes_dataset, map_old_to_new={"time": "tame", "space": "spice"} - ) + return valid_bboxes_dataset.rename({"time": "tame", "space": "spice"}) @pytest.fixture(params=["displacement", "velocity", "acceleration"])