changeset 34253:5ce32fe7df34

py3: fix doctests in patch.py to be compatible with Python 3 We were lucky that parsepatch() could concatenate a character slice as if it were a list of chunks.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 17 Sep 2017 12:23:16 +0900
parents c43d055ae405
children cd022a11ec83
files mercurial/patch.py tests/test-doctest.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Sep 17 12:20:35 2017 +0900
+++ b/mercurial/patch.py	Sun Sep 17 12:23:16 2017 +0900
@@ -1490,7 +1490,7 @@
     ...  5
     ...  d
     ... +lastline"""
-    >>> hunks = parsepatch(rawpatch)
+    >>> hunks = parsepatch([rawpatch])
     >>> hunkscomingfromfilterpatch = []
     >>> for h in hunks:
     ...     hunkscomingfromfilterpatch.append(h)
@@ -1501,7 +1501,7 @@
     >>> fp = util.stringio()
     >>> for c in reversedhunks:
     ...      c.write(fp)
-    >>> fp.seek(0)
+    >>> fp.seek(0) or None
     >>> reversedpatch = fp.read()
     >>> print(pycompat.sysstr(reversedpatch))
     diff --git a/folder1/g b/folder1/g
--- a/tests/test-doctest.py	Sun Sep 17 12:20:35 2017 +0900
+++ b/tests/test-doctest.py	Sun Sep 17 12:23:16 2017 +0900
@@ -57,7 +57,7 @@
 testmod('mercurial.match')
 testmod('mercurial.mdiff')
 testmod('mercurial.minirst')
-testmod('mercurial.patch', py3=False)  # py3: bytes[n], etc. ?
+testmod('mercurial.patch')
 testmod('mercurial.pathutil', py3=False)  # py3: os.sep
 testmod('mercurial.parser')
 testmod('mercurial.pycompat')