Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 94ce66d

Browse filesBrowse files
authored
Fix tests of the decorator exercise (empa-scientific-it#178)
1 parent 1b42590 commit 94ce66d
Copy full SHA for 94ce66d

File tree

Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-2
lines changed

‎tutorial/tests/test_functions_advanced.py

Copy file name to clipboardExpand all lines: tutorial/tests/test_functions_advanced.py
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import pathlib
2+
import re
23
import time
34
import typing as t
5+
from math import isclose
46
from string import ascii_lowercase as lowercase
57
from string import ascii_uppercase as uppercase # noqa: F401
68
from string import digits, punctuation # noqa: F401
@@ -183,7 +185,10 @@ def test_once_twice(function_to_test: t.Callable) -> None:
183185
_hello("world 2")
184186

185187
assert err.type is RuntimeError
186-
assert "Wait another 5." in err.value.args[0]
188+
assert "Wait another" in err.value.args[0]
189+
190+
wait_time = re.search(r"[\d.]+", err.value.args[0])
191+
assert wait_time and isclose(float(wait_time.group()), 5.0, abs_tol=1e-2)
187192

188193

189194
def test_once_waiting_not_enough_time(function_to_test: t.Callable) -> None:
@@ -198,7 +203,10 @@ def test_once_waiting_not_enough_time(function_to_test: t.Callable) -> None:
198203
_hello("world 2")
199204

200205
assert err.type is RuntimeError
201-
assert "Wait another 1." in err.value.args[0]
206+
assert "Wait another" in err.value.args[0]
207+
208+
wait_time = re.search(r"[\d.]+", err.value.args[0])
209+
assert wait_time and isclose(float(wait_time.group()), 1.0, abs_tol=1e-2)
202210

203211

204212
#

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.