-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving private doctests to pytests for physchemdata, tensor, statisti…
…cs and vector (#926) Another round
- Loading branch information
Showing
8 changed files
with
138 additions
and
33 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
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
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,32 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests for mathics.builtins.physchemdata | ||
""" | ||
|
||
from test.helper import check_evaluation | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("str_expr", "msgs", "str_expected", "fail_msg"), | ||
[ | ||
( | ||
'Outer[ElementData, Range[118], ElementData["Properties"]];', | ||
None, | ||
"Null", | ||
"Ensure all data parses #664", | ||
), | ||
], | ||
) | ||
def test_private_doctests_physchemdata(str_expr, msgs, str_expected, fail_msg): | ||
""" """ | ||
check_evaluation( | ||
str_expr, | ||
str_expected, | ||
to_string_expr=True, | ||
to_string_expected=True, | ||
hold_expected=False, | ||
failure_message=fail_msg, | ||
expected_messages=msgs, | ||
) |
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,31 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests from mathics.builtin.statistics. | ||
""" | ||
|
||
import sys | ||
import time | ||
from test.helper import check_evaluation, evaluate | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("str_expr", "msgs", "str_expected", "fail_msg"), | ||
[ | ||
("Sort[{x_, y_}, PatternsOrderedQ]", None, "{x_, y_}", None), | ||
], | ||
) | ||
def test_private_doctests_statistics_orderstatistics( | ||
str_expr, msgs, str_expected, fail_msg | ||
): | ||
""" """ | ||
check_evaluation( | ||
str_expr, | ||
str_expected, | ||
to_string_expr=True, | ||
to_string_expected=True, | ||
hold_expected=True, | ||
failure_message=fail_msg, | ||
expected_messages=msgs, | ||
) |
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,41 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests from mathics.builtin.tensor. | ||
""" | ||
|
||
import sys | ||
import time | ||
from test.helper import check_evaluation, evaluate | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("str_expr", "msgs", "str_expected", "fail_msg"), | ||
[ | ||
("Dimensions[{}]", None, "{0}", None), | ||
("Dimensions[{{}}]", None, "{1, 0}", None), | ||
## Issue #670 | ||
( | ||
"A = {{ b ^ ( -1 / 2), 0}, {a * b ^ ( -1 / 2 ), b ^ ( 1 / 2 )}}", | ||
None, | ||
"{{1 / Sqrt[b], 0}, {a / Sqrt[b], Sqrt[b]}}", | ||
None, | ||
), | ||
("A . Inverse[A]", None, "{{1, 0}, {0, 1}}", None), | ||
("A", None, "{{1 / Sqrt[b], 0}, {a / Sqrt[b], Sqrt[b]}}", None), | ||
# Transpose | ||
("Transpose[x]", None, "Transpose[x]", None), | ||
], | ||
) | ||
def test_private_doctests_tensor(str_expr, msgs, str_expected, fail_msg): | ||
""" """ | ||
check_evaluation( | ||
str_expr, | ||
str_expected, | ||
to_string_expr=True, | ||
to_string_expected=True, | ||
hold_expected=True, | ||
failure_message=fail_msg, | ||
expected_messages=msgs, | ||
) |
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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Unit tests from mathics.builtin.vectors.vector_space_operations. | ||
""" | ||
|
||
import sys | ||
import time | ||
from test.helper import check_evaluation, evaluate | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("str_expr", "msgs", "str_expected", "fail_msg"), | ||
[ | ||
("Normalize[0]", None, "0", None), | ||
("Normalize[{0}]", None, "{0}", None), | ||
("Normalize[{}]", None, "{}", None), | ||
("VectorAngle[{0, 1}, {0, 1}]", None, "0", None), | ||
], | ||
) | ||
def test_private_doctests_vector_space_operations( | ||
str_expr, msgs, str_expected, fail_msg | ||
): | ||
""" """ | ||
check_evaluation( | ||
str_expr, | ||
str_expected, | ||
to_string_expr=True, | ||
to_string_expected=True, | ||
hold_expected=True, | ||
failure_message=fail_msg, | ||
expected_messages=msgs, | ||
) |