Skip to content

Commit d97cdc7

Browse files
committed
Add Issue #1168 as a test case
And move some other issues to py.test tests
1 parent df9f36d commit d97cdc7

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

mathics/builtin/calculus.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -697,15 +697,6 @@ class Solve(Builtin):
697697
: Pi is not a valid variable.
698698
= Solve[False, Pi]
699699
700-
## Issue63
701-
#> Solve[{(7+x)*ma == 167, (5+x)*mb == 167, (7+5)*(ma+mb) == 334}, {ma, mb, x}]
702-
= {{ma -> 1169 / 12 - 167 Sqrt[37] / 12, mb -> -835 / 12 + 167 Sqrt[37] / 12, x -> Sqrt[37]}, {ma -> 1169 / 12 + 167 Sqrt[37] / 12, mb -> -835 / 12 - 167 Sqrt[37] / 12, x -> -Sqrt[37]}}
703-
#> Solve[{(7+x)*ma == 167, (5+x)*mb == 167, (7+5)*(ma+mb) == 334}, {x, ma, mb}]
704-
= {{x -> -Sqrt[37], ma -> 1169 / 12 + 167 Sqrt[37] / 12, mb -> -835 / 12 - 167 Sqrt[37] / 12}, {x -> Sqrt[37], ma -> 1169 / 12 - 167 Sqrt[37] / 12, mb -> -835 / 12 + 167 Sqrt[37] / 12}}
705-
706-
## Issue 208
707-
#> Solve[x + 1 == 2, x]
708-
= {{x -> 1}}
709700
"""
710701

711702
messages = {

test/test_calculus.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
from .helper import check_evaluation
3+
4+
5+
def test_calculus():
6+
for str_expr, str_expected, message in (
7+
(
8+
"Solve[{(7+x)*ma == 167, (5+x)*mb == 167, (7+5)*(ma+mb) == 334}, {ma, mb, x}]",
9+
"{{ma -> 1169 / 12 - 167 Sqrt[37] / 12, mb -> -835 / 12 + 167 Sqrt[37] / 12, x -> Sqrt[37]}, {ma -> 1169 / 12 + 167 Sqrt[37] / 12, mb -> -835 / 12 - 167 Sqrt[37] / 12, x -> -Sqrt[37]}}",
10+
"Issue63",
11+
),
12+
(
13+
"Solve[{(7+x)*ma == 167, (5+x)*mb == 167, (7+5)*(ma+mb) == 334}, {x, ma, mb}]",
14+
"{{x -> -Sqrt[37], ma -> 1169 / 12 + 167 Sqrt[37] / 12, mb -> -835 / 12 - 167 Sqrt[37] / 12}, {x -> Sqrt[37], ma -> 1169 / 12 - 167 Sqrt[37] / 12, mb -> -835 / 12 + 167 Sqrt[37] / 12}}",
15+
"Issue 208",
16+
),
17+
(
18+
"Solve[x + 1 == 2, x]",
19+
"{{x -> 1}}",
20+
"",
21+
),
22+
(
23+
"Solve[{a == 1, 0==0, b==I, 1==1},{a}]",
24+
"{{a -> 1}}",
25+
"Issue #1168",
26+
),
27+
):
28+
check_evaluation(str_expr, str_expected, message)

0 commit comments

Comments
 (0)