mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Make bytes_repr return a string containing a b"" literal.
This commit is contained in:
parent
fa353657f0
commit
ee91be45df
4 changed files with 58 additions and 58 deletions
|
@ -69,9 +69,11 @@ class BytesTest(unittest.TestCase):
|
|||
self.assertRaises(ValueError, bytes, [10**100])
|
||||
|
||||
def test_repr(self):
|
||||
self.assertEqual(repr(bytes()), "bytes()")
|
||||
self.assertEqual(repr(bytes([0])), "bytes([0x00])")
|
||||
self.assertEqual(repr(bytes([0, 1, 254, 255])), "bytes([0x00, 0x01, 0xfe, 0xff])")
|
||||
self.assertEqual(repr(bytes()), "b''")
|
||||
self.assertEqual(repr(bytes([0])), "b'\\0'")
|
||||
self.assertEqual(repr(bytes([0, 1, 254, 255])), "b'\\0\\x01\\xfe\\xff'")
|
||||
self.assertEqual(repr(bytes('abc')), "b'abc'")
|
||||
self.assertEqual(repr(bytes("'")), "b'\\''")
|
||||
|
||||
def test_compare(self):
|
||||
b1 = bytes([1, 2, 3])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue