Skip to content
Snippets Groups Projects
Commit 7d238ea4 authored by Joseph Weston's avatar Joseph Weston
Browse files

check for warning when a sympy expression is passed to 'lambdify'

parent 82b584cd
No related branches found
No related tags found
No related merge requests found
...@@ -185,5 +185,12 @@ def test_lambdify_substitutions(e, kwargs): ...@@ -185,5 +185,12 @@ def test_lambdify_substitutions(e, kwargs):
should_be = lambda x, y, z: x + y + z should_be = lambda x, y, z: x + y + z
subs = {'y': 'y + z'} subs = {'y': 'y + z'}
e = lambdify(e, locals=subs) if not isinstance(e, str):
# warns that 'locals' are not used if 'e' is
# a sympy expression already
with pytest.warns(RuntimeWarning):
e = lambdify(e, locals=subs)
else:
e = lambdify(e, locals=subs)
assert e(**kwargs) == should_be(**kwargs) assert e(**kwargs) == should_be(**kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment