Skip to content
Prev Previous commit
Next Next commit
ignore the warning in the doctest
  • Loading branch information
gpshead committed Mar 21, 2025
commit 8c6fd9b0b5b51146d04c0a0cdbe978fcbaa10fc4
6 changes: 5 additions & 1 deletion Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2631,8 +2631,12 @@ will be pulled from the default value.
.. doctest::

>>> from datetime import datetime
>>> import warnings
>>> value = "2/29"
>>> datetime.strptime(value, "%m/%d")
>>> with warnings.catch_warnings():
Comment thread
gpshead marked this conversation as resolved.
Outdated
... warnings.simplefilter("ignore")
... datetime.strptime(value, "%m/%d")
...
Traceback (most recent call last):
...
ValueError: day 29 must be in range 1..28 for month 2 in year 1900
Expand Down