Commit 93edccad authored by Adam Blank's avatar Adam Blank
Browse files

fix differentation tests

parent ac2867e6
Showing with 10 additions and 8 deletions
+10 -8
......@@ -23,10 +23,12 @@ def sympy_to_us(expr):
return expr.replace("**", "^").replace("exp(", "e(").replace("atan(", "arctan(")
def pprint(expr, pr=True):
orig = expr_to_string(expr)
result = expr_to_string(oursimplify(expr), use_parens=False)
result_parens = expr_to_string(oursimplify(expr), use_parens=True)
print(expr)
orig = expr
result = expr_to_string(oursimplify(parse(expr)), use_parens=False)
result_parens = expr_to_string(oursimplify(parse(expr)), use_parens=True)
ref = nsimplify(expand(sympify(us_to_sympy(orig))))
print(result, ref, orig)
if pr:
print(orig, end=" ")
print(colored("=", 'yellow'), end=" ")
......@@ -40,21 +42,21 @@ def pprint(expr, pr=True):
"3*diff((4*x)^2 + 1, x)",
])
def test_basic_differentiation(expr):
pprint(parse(expr), False)
pprint(expr, False)
@pytest.mark.parametrize('expr', cases + cases_extend)
def test_more_differentiation(expr):
pprint(parse(('diff(' + expr + ', x)')), False)
pprint(('diff(' + expr + ', x)'), False)
@pytest.mark.parametrize('expr', cases2 + cases2_extend)
def test_moremore_differentiation(expr):
pprint(parse(('diff(' + expr + ', x)')), False)
pprint(('diff(' + expr + ', x)'), False)
@pytest.mark.parametrize('expr', cases + cases_extend)
def test_moremoremore_differentiation(expr):
pprint(parse(('diff(diff(' + expr + ', x), x)')), False)
pprint(('diff(diff(' + expr + ', x), x)'), False)
@pytest.mark.parametrize('expr', cases2 + cases2_extend)
def test_moremoremore_differentiation(expr):
pprint(parse(('diff(diff(' + expr + ', x), x)')), False)
\ No newline at end of file
pprint('diff(diff(' + expr + ', x), x)', False)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment