File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
brainpy/integrators/tests Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -135,37 +135,37 @@ def test_second_order_ode(self):
135135 # Split into: dx/dt = v, dv/dt = -k*x - c*v
136136 k = 1.0 # spring constant
137137 c = 0.1 # damping
138-
138+
139139 def dx (x , t , v ):
140140 """dx/dt = v"""
141141 return v
142-
142+
143143 def dv (v , t , x ):
144144 """dv/dt = -k*x - c*v"""
145145 return - k * x - c * v
146-
146+
147147 # Create joint equation
148148 eq = JointEq (dx , dv )
149-
149+
150150 # Test call
151151 result = eq (x = 1.0 , v = 0.0 , t = 0.0 )
152152 self .assertEqual (len (result ), 2 )
153153 self .assertEqual (result [0 ], 0.0 ) # dx/dt = v = 0
154154 self .assertEqual (result [1 ], - k * 1.0 ) # dv/dt = -k*x
155-
155+
156156 def test_second_order_ode_wrong_signature (self ):
157157 """Test that wrong signature gives helpful error message"""
158158 # WRONG: both x and v before t in dx function
159159 def dx_wrong (x , v , t ):
160160 return v
161-
161+
162162 def dv (v , t , x ):
163163 return - x
164-
164+
165165 # This should raise an error with helpful message
166166 with self .assertRaises (DiffEqError ) as cm :
167167 JointEq (dx_wrong , dv )
168-
168+
169169 # Check that error message is helpful
170170 error_msg = str (cm .exception )
171171 self .assertIn ('state variable' , error_msg .lower ())
You can’t perform that action at this time.
0 commit comments