From 92e30b81d8c12a4418792ef237dd01dccb803b96 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 2 Apr 2024 11:56:45 +0200 Subject: [PATCH] Fix doctest --- Doc/library/datetime.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 7e599dd98913fe..047427d3269027 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -2682,7 +2682,11 @@ Notes: exception when it encounters leap day because the default year used by the parser is not a leap year. Users run into this bug every four years... - >>> strptime(f"{month_day};1984", "%m/%d;%Y") # No leap year bug. + .. doctest:: + + >>> month_day = "02/29" + >>> datetime.strptime(f"{month_day};1984", "%m/%d;%Y") # No leap year bug. + datetime.datetime(1984, 2, 29, 0, 0) .. deprecated-removed:: 3.13 3.15 :meth:`~.datetime.strptime` calls using a format string containing