File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Original file line number Diff line number Diff line change 1
1
import pathlib
2
+ import re
2
3
import time
3
4
import typing as t
5
+ from math import isclose
4
6
from string import ascii_lowercase as lowercase
5
7
from string import ascii_uppercase as uppercase # noqa: F401
6
8
from string import digits , punctuation # noqa: F401
@@ -183,7 +185,10 @@ def test_once_twice(function_to_test: t.Callable) -> None:
183
185
_hello ("world 2" )
184
186
185
187
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 )
187
192
188
193
189
194
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:
198
203
_hello ("world 2" )
199
204
200
205
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 )
202
210
203
211
204
212
#
You can’t perform that action at this time.
0 commit comments