Skip to content

Commit 8c6fd9b

Browse files
committed
ignore the warning in the doctest
1 parent 9c0d4f8 commit 8c6fd9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/datetime.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,8 +2631,12 @@ will be pulled from the default value.
26312631
.. doctest::
26322632

26332633
>>> from datetime import datetime
2634+
>>> import warnings
26342635
>>> value = "2/29"
2635-
>>> datetime.strptime(value, "%m/%d")
2636+
>>> with warnings.catch_warnings():
2637+
... warnings.simplefilter("ignore")
2638+
... datetime.strptime(value, "%m/%d")
2639+
...
26362640
Traceback (most recent call last):
26372641
...
26382642
ValueError: day 29 must be in range 1..28 for month 2 in year 1900

0 commit comments

Comments
 (0)