-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put test_rules_patterns tests where they belong
- Loading branch information
Showing
3 changed files
with
122 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests from mathics.builtin.atomic.symbols. | ||
""" | ||
|
||
from test.helper import check_evaluation | ||
|
||
|
||
def test_downvalues(): | ||
for str_expr, str_expected, message in ( | ||
( | ||
"DownValues[foo]={x_^2:>y}", | ||
"{x_ ^ 2 :> y}", | ||
"Issue #1251 part 1", | ||
), | ||
( | ||
"PrependTo[DownValues[foo], {x_^3:>z}]", | ||
"{{x_ ^ 3 :> z}, HoldPattern[x_ ^ 2] :> y}", | ||
"Issue #1251 part 2", | ||
), | ||
( | ||
"DownValues[foo]={x_^3:>y}", | ||
"{x_ ^ 3 :> y}", | ||
"Issue #1251 part 3", | ||
), | ||
): | ||
check_evaluation(str_expr, str_expected, message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests from mathics.builtin.patterns. | ||
""" | ||
|
||
from test.helper import check_evaluation | ||
|
||
|
||
def test_blank(): | ||
for str_expr, str_expected, message in ( | ||
( | ||
"g[i] /. _[i] :> a", | ||
"a", | ||
"Issue #203", | ||
), | ||
): | ||
check_evaluation(str_expr, str_expected, message) | ||
|
||
|
||
def test_replace_all(): | ||
for str_expr, str_expected, message in ( | ||
( | ||
"a == d b + d c /. a_ x_ + a_ y_ -> a (x + y)", | ||
"a == (b + c) d", | ||
"Issue #212", | ||
), | ||
): | ||
check_evaluation(str_expr, str_expected, message) |