Skip to content

Commit

Permalink
test: Unify pytest.mark.parametrize (#412)
Browse files Browse the repository at this point in the history
resolves #411
  • Loading branch information
SiQube authored May 15, 2023
1 parent 665a69b commit 6d1a750
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion tests/dataset/dataset_download_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CustomPublicDataset(pm.DatasetDefinition):


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/dataset_paths_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_kwargs, expected_paths',
('init_kwargs', 'expected_paths'),
[
pytest.param(
{'root': '/data/set/path'},
Expand Down
30 changes: 15 additions & 15 deletions tests/dataset/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def test_load_correct_event_dfs(dataset_configuration):


@pytest.mark.parametrize(
'subset, fileinfo_idx',
('subset', 'fileinfo_idx'),
[
pytest.param(
{'subject_id': 1},
Expand All @@ -328,7 +328,7 @@ def test_load_subset(subset, fileinfo_idx, dataset_configuration):


@pytest.mark.parametrize(
'init_kwargs, load_kwargs, exception',
('init_kwargs', 'load_kwargs', 'exception'),
[
pytest.param(
{},
Expand Down Expand Up @@ -365,7 +365,7 @@ def test_load_exceptions(init_kwargs, load_kwargs, exception, dataset_configurat


@pytest.mark.parametrize(
'init_kwargs, save_kwargs, exception',
('init_kwargs', 'save_kwargs', 'exception'),
[
pytest.param(
{},
Expand All @@ -387,7 +387,7 @@ def test_save_gaze_exceptions(init_kwargs, save_kwargs, exception, dataset_confi


@pytest.mark.parametrize(
'init_kwargs, load_kwargs, exception',
('init_kwargs', 'load_kwargs', 'exception'),
[
pytest.param(
{},
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_load_events_exceptions(init_kwargs, load_kwargs, exception, dataset_con


@pytest.mark.parametrize(
'init_kwargs, save_kwargs, exception',
('init_kwargs', 'save_kwargs', 'exception'),
[
pytest.param(
{},
Expand Down Expand Up @@ -602,7 +602,7 @@ def test_detect_events_explicit_eye(detect_event_kwargs, dataset_configuration):


@pytest.mark.parametrize(
'detect_event_kwargs_1, detect_event_kwargs_2, expected_schema',
('detect_event_kwargs_1', 'detect_event_kwargs_2', 'expected_schema'),
[
pytest.param(
{
Expand Down Expand Up @@ -687,7 +687,7 @@ def test_detect_events_attribute_error(dataset_configuration):


@pytest.mark.parametrize(
'events_init, events_expected',
('events_init', 'events_expected'),
[
pytest.param(
[],
Expand Down Expand Up @@ -728,7 +728,7 @@ def test_clear_events(events_init, events_expected, tmp_path):


@pytest.mark.parametrize(
'detect_event_kwargs, events_dirname, expected_save_dirpath, save_kwargs',
('detect_event_kwargs', 'events_dirname', 'expected_save_dirpath', 'save_kwargs'),
[
pytest.param(
{'method': pm.events.microsaccades, 'threshold': 1, 'eye': 'auto'},
Expand Down Expand Up @@ -778,7 +778,7 @@ def test_save_events(


@pytest.mark.parametrize(
'detect_event_kwargs, events_dirname, expected_save_dirpath, load_save_kwargs',
('detect_event_kwargs', 'events_dirname', 'expected_save_dirpath', 'load_save_kwargs'),
[
pytest.param(
{'method': pm.events.microsaccades, 'threshold': 1, 'eye': 'auto'},
Expand Down Expand Up @@ -834,7 +834,7 @@ def test_load_previously_saved_events_gaze(


@pytest.mark.parametrize(
'preprocessed_dirname, expected_save_dirpath',
('preprocessed_dirname', 'expected_save_dirpath'),
[
pytest.param(
None,
Expand Down Expand Up @@ -866,7 +866,7 @@ def test_save_preprocessed(preprocessed_dirname, expected_save_dirpath, dataset_


@pytest.mark.parametrize(
'expected_save_preprocessed_path, expected_save_events_path, save_kwargs',
('expected_save_preprocessed_path', 'expected_save_events_path', 'save_kwargs'),
[
pytest.param(
'preprocessed',
Expand Down Expand Up @@ -932,7 +932,7 @@ def test_save_creates_correct_directory(


@pytest.mark.parametrize(
'expected_save_preprocessed_path, expected_save_events_path, save_kwargs',
('expected_save_preprocessed_path', 'expected_save_events_path', 'save_kwargs'),
[
pytest.param(
'preprocessed',
Expand Down Expand Up @@ -990,7 +990,7 @@ def test_save_files_have_correct_extension(


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down Expand Up @@ -1070,7 +1070,7 @@ def test_paths(init_path, expected_paths):


@pytest.mark.parametrize(
'new_fileinfo, exception',
('new_fileinfo', 'exception'),
[
pytest.param(None, AttributeError),
pytest.param([], AttributeError),
Expand All @@ -1086,7 +1086,7 @@ def test_check_fileinfo(new_fileinfo, exception, tmp_path):


@pytest.mark.parametrize(
'new_gaze, exception',
('new_gaze', 'exception'),
[
pytest.param(None, AttributeError),
pytest.param([], AttributeError),
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/gazebase_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/gazebasevr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/judo1000_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/toy_dataset_eyelink_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/toy_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'init_path, expected_paths',
('init_path', 'expected_paths'),
[
pytest.param(
'/data/set/path',
Expand Down
4 changes: 2 additions & 2 deletions tests/events/detection/idt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'kwargs, expected_error',
('kwargs', 'expected_error'),
[
pytest.param(
{
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_idt_raises_error(kwargs, expected_error):


@pytest.mark.parametrize(
'kwargs, expected',
('kwargs', 'expected'),
[
pytest.param(
{
Expand Down
4 changes: 2 additions & 2 deletions tests/events/detection/ivt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@pytest.mark.parametrize(
'kwargs, expected_error',
('kwargs', 'expected_error'),
[
pytest.param(
{
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_ivt_raise_error(kwargs, expected_error):


@pytest.mark.parametrize(
'kwargs, expected',
('kwargs', 'expected'),
[
pytest.param(
{
Expand Down
6 changes: 3 additions & 3 deletions tests/events/detection/microsaccades_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


@pytest.mark.parametrize(
'kwargs, expected',
('kwargs', 'expected'),
[
pytest.param(
{
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_microsaccades_raises_error(kwargs, expected):


@pytest.mark.parametrize(
'kwargs, expected',
('kwargs', 'expected'),
[
pytest.param(
{
Expand Down Expand Up @@ -219,7 +219,7 @@ def test_microsaccades_detects_saccades(kwargs, expected):


@pytest.mark.parametrize(
'params, expected',
('params', 'expected'),
[
pytest.param(
{'method': 'invalid'},
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/center_origin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_center_origin_init_raises_error(kwargs, exception, msg_substrings):


@pytest.mark.parametrize(
'kwargs, series, expected_df',
('kwargs', 'series', 'expected_df'),
[
pytest.param(
{'screen_px': 100, 'origin': 'center', 'pixel_column': 'pixel'},
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/downsample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_downsample_init_raises_error(factor, exception, msg_substrings):


@pytest.mark.parametrize(
'factor, series, expected_df',
('factor', 'series', 'expected_df'),
[
pytest.param(
1,
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/norm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


@pytest.mark.parametrize(
'columns, df, expected_series',
('columns', 'df', 'expected_series'),
[
pytest.param(
('x', 'y'),
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/pix2deg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_pix2deg_raises_error(kwargs, series, exception, msg_substrings):


@pytest.mark.parametrize(
'kwargs, series, expected_df',
('kwargs', 'series', 'expected_df'),
[
pytest.param(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/pos2acc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_pos2acc_raises_error(kwargs, series, exception, msg_substrings):


@pytest.mark.parametrize(
'kwargs, series, expected_df',
('kwargs', 'series', 'expected_df'),
[
pytest.param(
{'window_length': 3, 'degree': 1, 'sampling_rate': 1},
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/pos2vel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_pos2vel_raises_error(kwargs, series, exception, msg_substrings):


@pytest.mark.parametrize(
'kwargs, series, expected_df',
('kwargs', 'series', 'expected_df'),
[
pytest.param(
{'method': 'savitzky_golay', 'window_length': 3, 'degree': 1, 'sampling_rate': 1},
Expand Down
2 changes: 1 addition & 1 deletion tests/gaze/transforms/savitzky_golay_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_savitzky_golay_raises_error(kwargs, series, exception, msg_substrings):


@pytest.mark.parametrize(
'kwargs, series, expected_df',
('kwargs', 'series', 'expected_df'),
[
pytest.param(
{'window_length': 3, 'degree': 1},
Expand Down
Loading

0 comments on commit 6d1a750

Please sign in to comment.