33
44class TestExtras (unittest .TestCase ):
55
6- def test_accdur ():
6+ def test_accdur (self ):
77 pass
88
9- def test_relerr ():
9+ def test_relerr (self ):
1010 x = np .array ([3 , 4 ])
1111 y = np .array ([- 2 , - 8 ])
1212 assert rc .relerr (x , y , order = 2 ) == 13 / 5
@@ -16,8 +16,24 @@ def test_relerr():
1616 assert np .all (rc .relerr (X , Y , order = 2 , axis = 0 ) == np .array ([1.25 ** .5 / 8 ** .5 , 1.5 / 8 ** .5 ]))
1717 assert np .all (rc .relerr (X .T , Y .T , order = "inf" , axis = 1 ) == np .array ([1 / 2 , 1.5 / 2 ]))
1818
19- def test_sys_fit ():
19+ def test_sys_fit (self ):
2020 pass
2121
22- def test_train_test ():
22+ def test_train_test (self ):
2323 pass
24+
25+ def test_nrmse (self ):
26+ # Compare with results from R (hydroGOF package)
27+ x = np .array ([2 ,3 ,4 ,5 ])
28+ y = np .array ([2 ,3 ,5 ,5 ])
29+ assert np .isclose (rc .nrmse (x ,y ), 0.387 )
30+ A = np .array ([[2 ,3 ],[4 ,5 ]])
31+ B = np .array ([2 ,3 ],[5 ,5 ]])
32+ assert np .isclose (rc .nrmse (A ,B , axis = 1 ), np .array ([0 , 1 ]))
33+ assert np .isclose (rc .nrmse (A ,B , axis = 0 ), np .array ([.5 , 0 ]))
34+
35+ def test_valid_prediction_index (self ):
36+ err = [0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ,0 ]
37+ idx = rc .valid_prediction_index (err , .5 )
38+ assert idx == 7
39+
0 commit comments