Adddoes the smart substitution but
x.subs(x - 1, y)vs.
(x + 1).subs(x - 1, y)
Symbol._eval_subsshould do the same thing as
[simplify(element) for element in a_list]. With the latter, I get the same expressions as in Mathematica, the former does not simplify at all o_O. In any case: thanks for opening the issue :-)
I'm trying to hunt down where in my code I'm using a now deprecated sympy function. I'm using pytest & python 3.7 and I'm looking at the python docs. This should work, but I can't seem to make it trigger:
$ PYTHONWARNINGS='ignore,error:::sympy' PYTHON=python3.7 PYTHONPATH=~/vc/sympy ./scripts/run_tests.sh chempy/util/pyutil.py ==== 6 passed, 1 skipped in 0.53 seconds ==== /home/bjorn/vc/sympy/sympy/matrices/matrices.py:2491: SymPyDeprecationWarning: Dot product of non row/column vectors has been deprecated since SymPy 1.2. Use * to take matrix products instead. See https://github.com/sympy/sympy/issues/13815 for more info. useinstead="* to take matrix products").warn()
if I change the
PYTHONWARNINGS environment variable to simply
error::DeprecationWarning it triggers way before actually running the tests:
Traceback (most recent call last): ... File "/opt/py37/lib/python3.7/site-packages/_pytest/assertion/rewrite.py", line 6, in <module> import imp File "/opt/py37/lib/python3.7/imp.py", line 33, in <module> DeprecationWarning, stacklevel=2) DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
does anyone know the proper syntax to specifically turn SymPy warnings into errors?
PYTHONWARNINGS='ignore,error::DeprecationWarning:sympy'and a few other combinations to no avail)
Invalid -W option ignored: invalid module name: 'sympy.utilities.exceptions'