Skip to content

Commit 614e258

Browse files
Merge pull request #212 from lambda-feedback/tr183-change-sympy-field-in-preview-response
Changed content of the sympy field in the result when input is not latex
2 parents 19a8d85 + 6451703 commit 614e258

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

app/example_tests.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,36 @@ def test_setting_input_symbols_to_be_assumed_positive_to_avoid_issues_with_fract
4747
@pytest.mark.parametrize(
4848
"response, is_latex, response_latex",
4949
[
50-
(r"\pm x^{2}+\mp y^{2}", True, r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"),
51-
("plus_minus x**2 + minus_plus y**2", False, r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"),
52-
("- minus_plus x^2 minus_plus y^2", False, r"\left\{- x^{2} + y^{2},~x^{2} - y^{2}\right\}"),
53-
("- minus_plus x^2 - plus_minus y^2", False, r"\left\{x^{2} - y^{2},~- x^{2} - - y^{2}\right\}"),
54-
("pm x**2 + mp y**2", False, r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"),
55-
("+- x**2 + -+ y**2", False, r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"),
50+
(
51+
r"\pm x^{2}+\mp y^{2}",
52+
True,
53+
r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"
54+
),
55+
(
56+
"plus_minus x**2 + minus_plus y**2",
57+
False,
58+
r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"
59+
),
60+
(
61+
"- minus_plus x^2 minus_plus y^2",
62+
False,
63+
r"\left\{- x^{2} + y^{2},~x^{2} - y^{2}\right\}"
64+
),
65+
(
66+
"- minus_plus x^2 - plus_minus y^2",
67+
False,
68+
r"\left\{x^{2} - y^{2},~- x^{2} - - y^{2}\right\}"
69+
),
70+
(
71+
"pm x**2 + mp y**2",
72+
False,
73+
r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"
74+
),
75+
(
76+
"+- x**2 + -+ y**2",
77+
False,
78+
r"\left\{x^{2} - y^{2},~- x^{2} + y^{2}\right\}"
79+
),
5680
]
5781
)
5882
def test_using_plus_minus_symbols(self, response, is_latex, response_latex):

app/symbolic_comparison_preview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def preview_function(response: str, params: Params, join_sympy=True) -> Result:
9898
sympy_out = []
9999
for expression in expression_list:
100100
latex_out.append(sympy_to_latex(expression, symbols, settings = {"mul_symbol": r" \cdot "}))
101-
sympy_out.append(str(expression))
101+
sympy_out.append(response)
102102

103103
if len(sympy_out) == 1:
104104
sympy_out = sympy_out[0]

0 commit comments

Comments
 (0)