Mercurial > public > mercurial-scm > hg
diff tests/test-encoding-func.py @ 52639:9db77d46de79
py3: drop redundant `u''` prefixes on string literals
Strings are unicode on Python 3. These were rewritten by `pyupgrade`.
It's arguably better to fix the `contrib` stuff upstream and then re-vendor it,
but I don't feel like waiting for that, and then all of the regression testing
involved to get a minor improvement in the codebase. It was last vendored 5
years ago, and will likely be a large change anyway to drop py2 support. Also,
we've already made minor formatting changes to it locally.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 06 Jan 2025 14:15:40 -0500 |
parents | 6000f5b25c9b |
children | 62546ee1f56b |
line wrap: on
line diff
--- a/tests/test-encoding-func.py Mon Jan 06 14:07:43 2025 -0500 +++ b/tests/test-encoding-func.py Mon Jan 06 14:15:40 2025 -0500 @@ -47,21 +47,21 @@ def testlossylatin(self): encoding.encoding = b'ascii' - s = u'\xc0'.encode('utf-8') + s = '\xc0'.encode('utf-8') l = encoding.tolocal(s) self.assertEqual(l, b'?') # lossy self.assertEqual(s, encoding.toutf8b(l)) # utf8 sequence preserved def testlosslesslatin(self): encoding.encoding = b'latin-1' - s = u'\xc0'.encode('utf-8') + s = '\xc0'.encode('utf-8') l = encoding.tolocal(s) self.assertEqual(l, b'\xc0') # lossless self.assertEqual(s, encoding.toutf8b(l)) # convert back to utf-8 def testlossy0xed(self): encoding.encoding = b'euc-kr' # U+Dxxx Hangul - s = u'\ud1bc\xc0'.encode('utf-8') + s = '\ud1bc\xc0'.encode('utf-8') l = encoding.tolocal(s) self.assertIn(b'\xed', l) self.assertTrue(l.endswith(b'?')) # lossy @@ -69,7 +69,7 @@ def testlossless0xed(self): encoding.encoding = b'euc-kr' # U+Dxxx Hangul - s = u'\ud1bc'.encode('utf-8') + s = '\ud1bc'.encode('utf-8') l = encoding.tolocal(s) self.assertEqual(l, b'\xc5\xed') # lossless self.assertEqual(s, encoding.toutf8b(l)) # convert back to utf-8