%PDF- %PDF-
Direktori : /usr/lib/python3/dist-packages/sympy/parsing/tests/ |
Current File : //usr/lib/python3/dist-packages/sympy/parsing/tests/test_ast_parser.py |
from sympy import symbols, S from sympy.parsing.ast_parser import parse_expr from sympy.testing.pytest import raises from sympy.core.sympify import SympifyError def test_parse_expr(): a, b = symbols('a, b') # tests issue_16393 parse_expr('a + b', {}) == a + b raises(SympifyError, lambda: parse_expr('a + ', {})) # tests Transform.visit_Num parse_expr('1 + 2', {}) == S(3) parse_expr('1 + 2.0', {}) == S(3.0) # tests Transform.visit_Name parse_expr('Rational(1, 2)', {}) == S(1)/2 parse_expr('a', {'a': a}) == a