forked from poldrack/pytest_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_5_parametric.py
More file actions
25 lines (23 loc) · 850 Bytes
/
test_5_parametric.py
File metadata and controls
25 lines (23 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
test for rtanalysis
- in this test, we will try various parameter levels
and make sure that the function properly raises
and exception is accuracy is zero
"""
import pytest
import numpy as np
from rtanalysis.rtanalysis import RTAnalysis
from rtanalysis.generate_testdata import generate_test_df
@pytest.mark.parametrize("meanRT, sdRT, meanAcc",
[(1.5, 1.0, 0.9), (1500, 1000, 0.9),
(1.5, 1.0, 0)])
def test_rtanalysis_parameteric(meanRT, sdRT, meanAcc):
test_df = generate_test_df(meanRT, sdRT, meanAcc)
rta = RTAnalysis()
if meanAcc > 0:
rta.fit(test_df.rt, test_df.accuracy)
assert np.allclose(meanRT, rta.meanrt_)
assert np.allclose(meanAcc, rta.meanacc_)
else:
with pytest.raises(ValueError):
rta.fit(test_df.rt, test_df.accuracy)