Skip to content

Commit

Permalink
add tests for fill, need events kwarg in from_numpy() to work
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrako committed Sep 13, 2023
1 parent 0a6a4df commit 5ee2320
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions tests/gaze/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,69 +517,72 @@
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],
offsets=[9],
),
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],
offsets=[99],
),
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],
offsets=[49],
),
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],
Expand All @@ -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)

0 comments on commit 5ee2320

Please sign in to comment.