Skip to content

Commit 0b48d4d

Browse files
F-parkmiss-islington
authored andcommitted
pythongh-112925: Fix error in example of datetime.time.fromisoformat and add doctest marker (pythonGH-112931)
(cherry picked from commit bdc8d66) Co-authored-by: F-park <[email protected]>
1 parent c7874bb commit 0b48d4d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/datetime.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,8 @@ Other constructor:
17931793

17941794
Examples::
17951795

1796+
.. doctest::
1797+
17961798
>>> from datetime import time
17971799
>>> time.fromisoformat('04:23:01')
17981800
datetime.time(4, 23, 1)
@@ -1802,7 +1804,7 @@ Other constructor:
18021804
datetime.time(4, 23, 1)
18031805
>>> time.fromisoformat('04:23:01.000384')
18041806
datetime.time(4, 23, 1, 384)
1805-
>>> time.fromisoformat('04:23:01,000')
1807+
>>> time.fromisoformat('04:23:01,000384')
18061808
datetime.time(4, 23, 1, 384)
18071809
>>> time.fromisoformat('04:23:01+04:00')
18081810
datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))

0 commit comments

Comments
 (0)