aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
57 stars 11 forks source link

test: Test for warning when distance column and distance_cm specified #615

Closed jakobchwastek closed 7 months ago

jakobchwastek commented 8 months ago

fix #610

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (9cada8b) 100.00% compared to head (619d0fd) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #615 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 53 53 Lines 2388 2388 Branches 599 599 ========================================= Hits 2388 2388 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jakobchwastek commented 8 months ago

The pix2deg_distance_experiment_and_distance_column_defaults_to_column test is failing now because we treat the warning it is triggering as error. Any suggestions on how to handle this? I would like to keep the test

https://github.com/aeye-lab/pymovements/blame/a95c1da4a23dbbb1f23229d90ed1203a21ace4f6/tests/unit/gaze/gaze_transform_test.py#L489

dkrako commented 8 months ago

The pix2deg_distance_experiment_and_distance_column_defaults_to_column test is failing now because we treat the warning it is triggering as error. Any suggestions on how to handle this? I would like to keep the test

https://github.com/aeye-lab/pymovements/blame/a95c1da4a23dbbb1f23229d90ed1203a21ace4f6/tests/unit/gaze/gaze_transform_test.py#L489

Move the test case to ta new function and add the expected warning to the parameters:

def test_gaze_transform_expected_frame_warning(
        gaze_init_kwargs, transform_method, transform_kwargs, expected_result, expected_warning,
):
    with pytest.warns(expected_warning) as excinfo:
      gaze = pm.GazeDataFrame(**gaze_init_kwargs)
      gaze.transform(transform_method, **transform_kwargs)

    assert_frame_equal(gaze.frame, expected.frame)
jakobchwastek commented 7 months ago

Should be done