diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-12-19 21:28:46 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-12-19 21:28:46 (GMT) |
commit | 7643c92cdd0e8a3cfd83be9edae3964097b63f0e (patch) | |
tree | 2eccc052cc4b4d7e8f51f152c601a5dc48bb53b7 /Lib/test | |
parent | af5e29a769c1db9c1dd24b6d7344b9c6e0f2713f (diff) | |
parent | 5ff3f73d94305900c0773e67ebdd9701d856a0fe (diff) | |
download | cpython-7643c92cdd0e8a3cfd83be9edae3964097b63f0e.zip cpython-7643c92cdd0e8a3cfd83be9edae3964097b63f0e.tar.gz cpython-7643c92cdd0e8a3cfd83be9edae3964097b63f0e.tar.bz2 |
merge 3.3 (#16722)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_bytes.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 8ae90e4..2b32767 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -715,6 +715,12 @@ class BytesTest(BaseBytesTest): def __bytes__(self): return None self.assertRaises(TypeError, bytes, A()) + class A: + def __bytes__(self): + return b'a' + def __index__(self): + return 42 + self.assertEqual(bytes(A()), b'a') # Test PyBytes_FromFormat() def test_from_format(self): |