File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
CPAC/nuisance/tests/utils Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from CPAC .nuisance .utils import compcor
4+
5+
6+ def test_TR_string_to_float ():
7+ assert abs (compcor .TR_string_to_float ('123' ) - 123. ) < 1e-08
8+ assert abs (compcor .TR_string_to_float ('123s' ) - 123. ) < 1e-08
9+ assert abs (compcor .TR_string_to_float ('123ms' ) - 123. / 1000 ) < 1e-08
10+
11+ assert abs (compcor .TR_string_to_float ('1.23' ) - 1.23 ) < 1e-08
12+ assert abs (compcor .TR_string_to_float ('1.23s' ) - 1.23 ) < 1e-08
13+ assert abs (compcor .TR_string_to_float ('1.23ms' ) - 1.23 / 1000 ) < 1e-08
14+
15+ with pytest .raises (Exception ):
16+ compcor .TR_string_to_float (None )
17+
18+ with pytest .raises (Exception ):
19+ compcor .TR_string_to_float (['123' ])
20+
21+ with pytest .raises (Exception ):
22+ compcor .TR_string_to_float (123 )
23+
24+ with pytest .raises (Exception ):
25+ compcor .TR_string_to_float ('ms' )
You can’t perform that action at this time.
0 commit comments