File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pathlib
2+ import re
23import time
34import typing as t
5+ from math import isclose
46from string import ascii_lowercase as lowercase
57from string import ascii_uppercase as uppercase # noqa: F401
68from 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
189194def 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#
You can’t perform that action at this time.
0 commit comments