From fae010c0831878cbeadc9f9cfab32dfff67fdb4a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:14:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/conftest.py | 34 +++++++++++++++++-- .../test_validators/test_files_validators.py | 9 ++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f1cb8cab..7f9801f8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -198,11 +198,26 @@ def dlc_style_df(): """Return a valid DLC-style DataFrame.""" return pd.read_hdf(pytest.DATA_PATHS.get("DLC_single-wasp.predictions.h5")) + @pytest.fixture def missing_keypoint_headers_anipose_csv_file(tmp_path): """Return the file path for a fake single-individual .csv file.""" file_path = tmp_path / "missing_keypoint_headers.csv" - headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01", "M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"] + headers = [ + "fnum", + "center_0", + "center_1", + "center_2", + "M_00", + "M_01", + "M_02", + "M_10", + "M_11", + "M_12", + "M_20", + "M_21", + "M_22", + ] headers.extend(["kp0_x", "kp0_y", "kp0_score", "kp0_error", "kp0_ncams"]) with open(file_path, "w") as f: f.write(",".join(headers)) @@ -210,11 +225,26 @@ def missing_keypoint_headers_anipose_csv_file(tmp_path): f.write(",".join(["1"] * len(headers))) return file_path + @pytest.fixture def spurious_header_anipose_csv_file(tmp_path): """Return the file path for a fake single-individual .csv file.""" file_path = tmp_path / "spurious_header.csv" - headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01", "M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"] + headers = [ + "fnum", + "center_0", + "center_1", + "center_2", + "M_00", + "M_01", + "M_02", + "M_10", + "M_11", + "M_12", + "M_20", + "M_21", + "M_22", + ] headers.extend(["funny_header"]) with open(file_path, "w") as f: f.write(",".join(headers)) diff --git a/tests/test_unit/test_validators/test_files_validators.py b/tests/test_unit/test_validators/test_files_validators.py index 0c0ea3c8..20517675 100644 --- a/tests/test_unit/test_validators/test_files_validators.py +++ b/tests/test_unit/test_validators/test_files_validators.py @@ -1,11 +1,11 @@ import pytest from movement.validators.files import ( + ValidAniposeCSV, ValidDeepLabCutCSV, ValidFile, ValidHDF5, ValidVIATracksCSV, - ValidAniposeCSV, ) @@ -177,23 +177,24 @@ def test_via_tracks_csv_validator_with_invalid_input( assert str(excinfo.value) == log_message + @pytest.mark.parametrize( "invalid_input, error_type, log_message", [ ( "invalid_single_individual_csv_file", ValueError, - "CSV file is missing some expected headers." + "CSV file is missing some expected headers.", ), ( "missing_keypoint_headers_anipose_csv_file", ValueError, - "Base header kp0 is missing some expected suffixes." + "Base header kp0 is missing some expected suffixes.", ), ( "spurious_header_anipose_csv_file", ValueError, - "Header funny_header does not have an expected suffix." + "Header funny_header does not have an expected suffix.", ), ], )