summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-02-24 19:41:35 (GMT)
committerGeorg Brandl <georg@python.org>2007-02-24 19:41:35 (GMT)
commitee91be45df796b8e5721d9142a6e92e55a465451 (patch)
tree9878cc28e6145f4985c2d6e323f84657e60eb650 /Lib/test/test_bytes.py
parentfa353657f0da969eb6bc1cf62fb3c69dd036463a (diff)
downloadcpython-ee91be45df796b8e5721d9142a6e92e55a465451.zip
cpython-ee91be45df796b8e5721d9142a6e92e55a465451.tar.gz
cpython-ee91be45df796b8e5721d9142a6e92e55a465451.tar.bz2
Make bytes_repr return a string containing a b"" literal.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 4dee01b..83f6f93 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -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])