From 5ee232013d9b159cd6c27029a39da192cf722548 Mon Sep 17 00:00:00 2001 From: "Daniel G, Krakowczyk" Date: Wed, 13 Sep 2023 16:04:41 +0200 Subject: [PATCH] add tests for fill, need events kwarg in from_numpy() to work --- tests/gaze/detect_test.py | 71 ++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/tests/gaze/detect_test.py b/tests/gaze/detect_test.py index 4e5198a09..3132ec7fd 100644 --- a/tests/gaze/detect_test.py +++ b/tests/gaze/detect_test.py @@ -517,31 +517,25 @@ pm.EventDataFrame(), id='microsaccades_two_steps_one_saccade_timesteps', ), - ], -) -def test_gaze_detect(method, kwargs, gaze, expected): - gaze.detect(method, **kwargs) - assert_frame_equal(gaze.events.frame, expected.frame) - -""" - -@pytest.mark.parametrize( - ('kwargs', 'expected'), - [ pytest.param( - { - 'events': pm.EventDataFrame(name='fixation', onsets=[0], offsets=[100]), - 'timesteps': np.arange(0, 100), - }, + 'fill', + {}, + pm.gaze.from_numpy( + time=np.arange(0, 100), + events=pm.EventDataFrame(name='fixation', onsets=[0], offsets=[100]), + ), pm.EventDataFrame(), id='fixation_from_start_to_end_no_fill', ), + pytest.param( - { - 'events': pm.EventDataFrame(name='fixation', onsets=[10], offsets=[100]), - 'timesteps': np.arange(0, 100), - }, + 'fill', + {}, + pm.gaze.from_numpy( + time=np.arange(0, 100), + events=pm.EventDataFrame(name='fixation', onsets=[10], offsets=[100]), + ), pm.EventDataFrame( name='unclassified', onsets=[0], @@ -549,11 +543,14 @@ def test_gaze_detect(method, kwargs, gaze, expected): ), id='fixation_10_ms_after_start_to_end_single_fill', ), + pytest.param( - { - 'events': pm.EventDataFrame(name='fixation', onsets=[0], offsets=[90]), - 'timesteps': np.arange(0, 100), - }, + 'fill', + {}, + pm.gaze.from_numpy( + time=np.arange(0, 100), + events=pm.EventDataFrame(name='fixation', onsets=[0], offsets=[90]), + ), pm.EventDataFrame( name='unclassified', onsets=[90], @@ -561,11 +558,14 @@ def test_gaze_detect(method, kwargs, gaze, expected): ), id='fixation_from_start_to_10_ms_before_end_single_fill', ), + pytest.param( - { - 'events': pm.EventDataFrame(name='fixation', onsets=[0, 50], offsets=[40, 100]), - 'timesteps': np.arange(0, 100), - }, + 'fill', + {}, + pm.gaze.from_numpy( + time=np.arange(0, 100), + events=pm.EventDataFrame(name='fixation', onsets=[0, 50], offsets=[40, 100]), + ), pm.EventDataFrame( name='unclassified', onsets=[40], @@ -573,13 +573,16 @@ def test_gaze_detect(method, kwargs, gaze, expected): ), id='fixation_10_ms_break_at_40ms_single_fill', ), + pytest.param( - { - 'events': pm.EventDataFrame( + 'fill', + {}, + pm.gaze.from_numpy( + time=np.arange(0, 100), + events=pm.EventDataFrame( name=['fixation', 'saccade'], onsets=[0, 50], offsets=[40, 100], ), - 'timesteps': np.arange(0, 100), - }, + ), pm.EventDataFrame( name='unclassified', onsets=[40], @@ -589,6 +592,6 @@ def test_gaze_detect(method, kwargs, gaze, expected): ), ], ) - - -""" +def test_gaze_detect(method, kwargs, gaze, expected): + gaze.detect(method, **kwargs) + assert_frame_equal(gaze.events.frame, expected.frame)