def test_variable_init(self): a = pybamm.IndependentVariable("a") self.assertEqual(a.name, "a") self.assertEqual(a.domain, []) a = pybamm.IndependentVariable("a", domain=["test"]) self.assertEqual(a.domain[0], "test") a = pybamm.IndependentVariable("a", domain="test") self.assertEqual(a.domain[0], "test") with self.assertRaises(TypeError): pybamm.IndependentVariable("a", domain=1)
def test_jac_of_independent_variable(self): a = pybamm.IndependentVariable("Variable") y = pybamm.StateVector(slice(0, 1)) self.assertEqual(a.jac(y).evaluate(), 0)