changeset 52657:62546ee1f56b

pyupgrade: drop redundant `''.encode("utf-8")` Again, I'd prefer explicit. But without a way to selectively choose what fixes are applied by `_fix_tokens()`, I'll accept this for the sake of reducing the nuisance output when running `pyupgrade`.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 07 Jan 2025 17:36:13 -0500
parents 3e84e001b6c1
children c975e8ec08bb
files tests/test-encoding-func.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-encoding-func.py	Tue Jan 07 17:28:46 2025 -0500
+++ b/tests/test-encoding-func.py	Tue Jan 07 17:36:13 2025 -0500
@@ -47,21 +47,21 @@
 
     def testlossylatin(self):
         encoding.encoding = b'ascii'
-        s = '\xc0'.encode('utf-8')
+        s = '\xc0'.encode()
         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 = '\xc0'.encode('utf-8')
+        s = '\xc0'.encode()
         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 = '\ud1bc\xc0'.encode('utf-8')
+        s = '\ud1bc\xc0'.encode()
         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 = '\ud1bc'.encode('utf-8')
+        s = '\ud1bc'.encode()
         l = encoding.tolocal(s)
         self.assertEqual(l, b'\xc5\xed')  # lossless
         self.assertEqual(s, encoding.toutf8b(l))  # convert back to utf-8