@@ -35,6 +35,14 @@ def test_evaluate_list(self):
35
35
y = np .linspace (0 , 3 , 31 )
36
36
np .testing .assert_array_almost_equal (sv .evaluate (y = y ), y [:, np .newaxis ])
37
37
38
+ def test_diff (self ):
39
+ a = pybamm .StateVector (slice (0 , 10 ))
40
+ with self .assertRaises (NotImplementedError ):
41
+ a .diff (a )
42
+ b = pybamm .StateVectorDot (slice (0 , 10 ))
43
+ with self .assertRaises (NotImplementedError ):
44
+ a .diff (b )
45
+
38
46
def test_name (self ):
39
47
sv = pybamm .StateVector (slice (0 , 10 ))
40
48
self .assertEqual (sv .name , "y[0:10]" )
@@ -61,6 +69,7 @@ def test_failure(self):
61
69
with self .assertRaisesRegex (TypeError , "all y_slices must be slice objects" ):
62
70
pybamm .StateVector (slice (0 , 10 ), 1 )
63
71
72
+
64
73
class TestStateVectorDot (unittest .TestCase ):
65
74
def test_evaluate (self ):
66
75
sv = pybamm .StateVectorDot (slice (0 , 10 ))
@@ -72,14 +81,16 @@ def test_evaluate(self):
72
81
# Try evaluating with a y that is too short
73
82
y_dot2 = np .ones (5 )
74
83
with self .assertRaisesRegex (
75
- ValueError , "y_dot is too short, so value with slice is smaller than expected"
84
+ ValueError ,
85
+ "y_dot is too short, so value with slice is smaller than expected"
76
86
):
77
87
sv .evaluate (y_dot = y_dot2 )
78
88
79
89
def test_name (self ):
80
90
sv = pybamm .StateVectorDot (slice (0 , 10 ))
81
91
self .assertEqual (sv .name , "y_dot[0:10]" )
82
92
93
+
83
94
if __name__ == "__main__" :
84
95
print ("Add -v for more debug output" )
85
96
import sys
0 commit comments