]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-54434: Make difflib.rst doctests pass. (GH-111677) (#111679)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 3 Nov 2023 06:28:53 +0000 (07:28 +0100)
committerGitHub <noreply@github.com>
Fri, 3 Nov 2023 06:28:53 +0000 (06:28 +0000)
gh-54434: Make difflib.rst doctests pass. (GH-111677)
(cherry picked from commit 0d3df272fbd131bff7f02d4d4279ad1e35081121)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Doc/library/difflib.rst

index 431ee9c2c6ce174f026313f1c1c4cc0ed059f33a..83c669e50f1f857660c8c17af1c92707efed5b4f 100644 (file)
@@ -173,9 +173,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
    expressed in the ISO 8601 format. If not specified, the
    strings default to blanks.
 
+      >>> import sys
+      >>> from difflib import *
       >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
       >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
-      >>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py', tofile='after.py'))
+      >>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py',
+      ...                        tofile='after.py'))
       *** before.py
       --- after.py
       ***************
@@ -298,13 +301,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
    For inputs that do not have trailing newlines, set the *lineterm* argument to
    ``""`` so that the output will be uniformly newline free.
 
-   The context diff format normally has a header for filenames and modification
+   The unified diff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for *fromfile*,
    *tofile*, *fromfiledate*, and *tofiledate*.  The modification times are normally
    expressed in the ISO 8601 format. If not specified, the
    strings default to blanks.
 
-
       >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
       >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
       >>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py'))