diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-07-29 19:23:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-07-29 19:23:47 (GMT) |
commit | ce071ca4e76b67060f55c6ed6fd9a7433cb66013 (patch) | |
tree | 92ad6b3e0b6c42c342f3ad1886902b6aa14107f6 /Lib/test/test_builtin.py | |
parent | e12c0b1767309ec1fe727e91f8d4c0cfae4a88a8 (diff) | |
download | cpython-ce071ca4e76b67060f55c6ed6fd9a7433cb66013.zip cpython-ce071ca4e76b67060f55c6ed6fd9a7433cb66013.tar.gz cpython-ce071ca4e76b67060f55c6ed6fd9a7433cb66013.tar.bz2 |
bytes should be verboten in sum() (fixes #12654)
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index ce1586f..aa9b4e2 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1128,6 +1128,9 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(TypeError, sum, 42) self.assertRaises(TypeError, sum, ['a', 'b', 'c']) self.assertRaises(TypeError, sum, ['a', 'b', 'c'], '') + self.assertRaises(TypeError, sum, [b'a', b'c'], b'') + values = [bytearray(b'a'), bytearray(b'b')] + self.assertRaises(TypeError, sum, values, bytearray(b'')) self.assertRaises(TypeError, sum, [[1], [2], [3]]) self.assertRaises(TypeError, sum, [{2:3}]) self.assertRaises(TypeError, sum, [{2:3}]*2, {2:3}) |