changeset 32299:7040f5131454

encoding: use i.startswith() instead of i[0] to eliminate py2/3 divergence
author Yuya Nishihara <yuya@tcha.org>
date Tue, 16 May 2017 23:36:38 +0900
parents 779a1ae6d0d9
children bd0fd3ff9916
files mercurial/encoding.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Sat May 13 21:15:56 2017 -0400
+++ b/mercurial/encoding.py	Tue May 16 23:36:38 2017 +0900
@@ -29,10 +29,7 @@
            "200c 200d 200e 200f 202a 202b 202c 202d 202e "
            "206a 206b 206c 206d 206e 206f feff".split()]
 # verify the next function will work
-if pycompat.ispy3:
-    assert set(i[0] for i in _ignore) == {ord(b'\xe2'), ord(b'\xef')}
-else:
-    assert set(i[0] for i in _ignore) == {"\xe2", "\xef"}
+assert all(i.startswith(("\xe2", "\xef")) for i in _ignore)
 
 def hfsignoreclean(s):
     """Remove codepoints ignored by HFS+ from s.