Skip to content

Commit 0d3df27

Browse files
authored
gh-54434: Make difflib.rst doctests pass. (#111677)
1 parent 3a1b09e commit 0d3df27

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Doc/library/difflib.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
171171
expressed in the ISO 8601 format. If not specified, the
172172
strings default to blanks.
173173

174+
>>> import sys
175+
>>> from difflib import *
174176
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
175177
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
176-
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py', tofile='after.py'))
178+
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py',
179+
... tofile='after.py'))
177180
*** before.py
178181
--- after.py
179182
***************
@@ -294,13 +297,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
294297
For inputs that do not have trailing newlines, set the *lineterm* argument to
295298
``""`` so that the output will be uniformly newline free.
296299

297-
The context diff format normally has a header for filenames and modification
300+
The unified diff format normally has a header for filenames and modification
298301
times. Any or all of these may be specified using strings for *fromfile*,
299302
*tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
300303
expressed in the ISO 8601 format. If not specified, the
301304
strings default to blanks.
302305

303-
304306
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
305307
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
306308
>>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py'))

0 commit comments

Comments
 (0)