|
10 | 10 | import pytest |
11 | 11 |
|
12 | 12 |
|
13 | | -# @pytest.mark.skipif( |
14 | | -# sys.platform in ("win32", "emscripten") or hasattr(sys, "pyston_version_info"), |
15 | | -# reason="TimeConstrained needs to be rewritten", |
16 | | -# ) |
| 13 | +@pytest.mark.skipif( |
| 14 | + sys.platform in ("emscripten",), |
| 15 | + reason="TimeConstrained is based in Threads, which are not supported in Piodide", |
| 16 | +) |
17 | 17 | def test_timeremaining(): |
18 | 18 | str_expr = "TimeConstrained[1+2; TimeRemaining[], 0.9]" |
19 | 19 | result = evaluate(str_expr) |
20 | 20 | assert result is None or 0 < result.to_python() < 9 |
21 | 21 |
|
22 | 22 |
|
23 | | -# @pytest.mark.skip(reason="TimeConstrained needs to be rewritten") |
| 23 | +@pytest.mark.skipif( |
| 24 | + sys.platform in ("emscripten",), |
| 25 | + reason="TimeConstrained is based in Threads, which are not supported in Piodide", |
| 26 | +) |
24 | 27 | def test_timeconstrained1(): |
25 | 28 | # |
26 | 29 | str_expr1 = "a=1.; TimeConstrained[Do[Pause[.01];a=a+1,{1000}],.1]" |
@@ -109,6 +112,28 @@ def test_datestring(): |
109 | 112 | "Thu 6 Jun 1991 00:00:00", |
110 | 113 | "Specified separators", |
111 | 114 | ), |
| 115 | + ], |
| 116 | +) |
| 117 | +def test_private_doctests_datetime(str_expr, msgs, str_expected, fail_msg): |
| 118 | + """ """ |
| 119 | + check_evaluation( |
| 120 | + str_expr, |
| 121 | + str_expected, |
| 122 | + to_string_expr=True, |
| 123 | + to_string_expected=True, |
| 124 | + hold_expected=True, |
| 125 | + failure_message=fail_msg, |
| 126 | + expected_messages=msgs, |
| 127 | + ) |
| 128 | + |
| 129 | + |
| 130 | +@pytest.mark.skipif( |
| 131 | + sys.platform in ("emscripten",), |
| 132 | + reason="TimeConstrained is based in Threads, which are not supported in Piodide", |
| 133 | +) |
| 134 | +@pytest.mark.parametrize( |
| 135 | + ("str_expr", "msgs", "str_expected", "fail_msg"), |
| 136 | + [ |
112 | 137 | ## |
113 | 138 | ( |
114 | 139 | "TimeConstrained[Integrate[Sin[x]^100,x],.5]", |
@@ -139,8 +164,8 @@ def test_datestring(): |
139 | 164 | ("a=.;s=.;", None, "Null", None), |
140 | 165 | ], |
141 | 166 | ) |
142 | | -def test_private_doctests_datetime(str_expr, msgs, str_expected, fail_msg): |
143 | | - """ """ |
| 167 | +def test_private_doctests_TimeConstrained(str_expr, msgs, str_expected, fail_msg): |
| 168 | + """TimeConstrained tests""" |
144 | 169 | check_evaluation( |
145 | 170 | str_expr, |
146 | 171 | str_expected, |
|
0 commit comments