py3: make tests/test-diff-antipatience.t work with python 3
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 26 Jun 2018 00:37:02 +0530
changeset 38469 9ef9884e5d50
parent 38468 854c2ccc800e
child 38470 4c358bdaada8
py3: make tests/test-diff-antipatience.t work with python 3 On python3, if we do list(b'abcd'), we get [97, 98, 99, 100]. So this patch does the list() operation on unicodes and then convert things to bytes. This also adds `and None` to suppress return values of .write() calls. Differential Revision: https://phab.mercurial-scm.org/D3833
contrib/python3-whitelist
tests/test-diff-antipatience.t
--- a/contrib/python3-whitelist	Mon Jun 25 11:04:17 2018 -0700
+++ b/contrib/python3-whitelist	Tue Jun 26 00:37:02 2018 +0530
@@ -88,6 +88,7 @@
 test-debugindexdot.t
 test-debugrename.t
 test-default-push.t
+test-diff-antipatience.t
 test-diff-binary-file.t
 test-diff-change.t
 test-diff-copy-depth.t
--- a/tests/test-diff-antipatience.t	Mon Jun 25 11:04:17 2018 -0700
+++ b/tests/test-diff-antipatience.t	Tue Jun 26 00:37:02 2018 +0530
@@ -11,9 +11,9 @@
 Test case that makes use of the weakness of patience diff algorithm
 
   $ hg init
-  >>> open('a', 'wb').write(b'\n'.join(list(b'a' + b'x' * 10 + b'u' + b'x' * 30 + b'a\n')))
+  >>> open('a', 'wb').write(('\n'.join(list('a' + 'x' * 10 + 'u' + 'x' * 30 + 'a\n'))).encode('ascii')) and None
   $ hg commit -m 1 -A a
-  >>> open('a', 'wb').write(b'\n'.join(list(b'b' + b'x' * 30 + b'u' + b'x' * 10 + b'b\n')))
+  >>> open('a', 'wb').write(('\n'.join(list('b' + 'x' * 30 + 'u' + 'x' * 10 + 'b\n'))).encode('ascii')) and None
 #if xdiff
   $ hg diff
   diff -r f0aeecb49805 a