Skip to content

Commit acd3d10

Browse files
authored
Fix typeddict tests on systems with 32-bit time_t (#415)
Reduce the range of generated `datetime` instances to values valid for 32-bit `time_t` range, as otherwise multiple tests fail with errors such as: FAILED tests/test_typeddicts.py::test_simple_roundtrip - OverflowError: timestamp out of range for platform time_t This is based on an earlier fix for `test_preconf.py`, see a0e56f4 and c580287. Originally reported as https://bugs.gentoo.org/912187.
1 parent 17f4680 commit acd3d10

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/typeddicts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def int_attributes(
5959
def datetime_attributes(
6060
draw: DrawFn, total: bool = True, not_required: bool = False
6161
) -> Tuple[datetime, SearchStrategy, SearchStrategy]:
62-
success_strat = datetimes().map(lambda dt: dt.replace(microsecond=0))
62+
success_strat = datetimes(
63+
min_value=datetime(1970, 1, 1), max_value=datetime(2038, 1, 1)
64+
).map(lambda dt: dt.replace(microsecond=0))
6365
type = datetime
6466
strat = success_strat if total else success_strat | just(NOTHING)
6567
if not_required and draw(booleans()):

0 commit comments

Comments
 (0)