Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for sympy update #4253

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tests/unit/test_expression_tree/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,24 @@ def test_to_equation(self):
self.assertEqual(func.to_equation(), sympy.Symbol("test"))

# Test Arcsinh
self.assertEqual(pybamm.Arcsinh(a).to_equation(), sympy.asinh(a))
self.assertEqual(pybamm.Arcsinh(a).to_equation(), sympy.asinh("a"))

# Test Arctan
self.assertEqual(pybamm.Arctan(a).to_equation(), sympy.atan(a))
self.assertEqual(pybamm.Arctan(a).to_equation(), sympy.atan("a"))

# Test Exp
self.assertEqual(pybamm.Exp(a).to_equation(), sympy.exp(a))
self.assertEqual(pybamm.Exp(a).to_equation(), sympy.exp("a"))

# Test log
self.assertEqual(pybamm.Log(54.0).to_equation(), sympy.log(54.0))
value = 54.0
self.assertEqual(pybamm.Log(value).to_equation(), sympy.log(value))

# Test sinh
self.assertEqual(pybamm.Sinh(a).to_equation(), sympy.sinh(a))
self.assertEqual(pybamm.Sinh(a).to_equation(), sympy.sinh("a"))

# Test Function
self.assertEqual(pybamm.Function(np.log, 10).to_equation(), 10.0)
value = 10
self.assertEqual(pybamm.Function(np.log, value).to_equation(), value)

def test_to_from_json_error(self):
a = pybamm.Symbol("a")
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/test_expression_tree/test_unary_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,18 +699,19 @@ def test_to_equation(self):
self.assertEqual(pybamm.Floor(-2.5).to_equation(), sympy.Symbol("test"))

# Test Negate
self.assertEqual(pybamm.Negate(4).to_equation(), -4.0)
value = 4
self.assertEqual(pybamm.Negate(value).to_equation(), -value)

# Test AbsoluteValue
self.assertEqual(pybamm.AbsoluteValue(-4).to_equation(), 4.0)
self.assertEqual(pybamm.AbsoluteValue(-value).to_equation(), value)

# Test Gradient
self.assertEqual(pybamm.Gradient(a).to_equation(), sympy_Gradient("a"))

# Test Divergence
self.assertEqual(
pybamm.Divergence(pybamm.Gradient(a)).to_equation(),
sympy_Divergence(sympy_Gradient(a)),
sympy_Divergence(sympy_Gradient("a")),
)

# Test BoundaryValue
Expand Down
Loading