diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-08-29 18:47:16 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-08-29 18:47:16 (GMT) |
commit | 18c3ff887f95e7b566b36faf97d457372c04c213 (patch) | |
tree | d2d1242b8c7eca59638696b43b95004f64384e3e /Lib | |
parent | 991bf5d8c8fdd94c3b9238d7111c0dfb41973804 (diff) | |
download | cpython-18c3ff887f95e7b566b36faf97d457372c04c213.zip cpython-18c3ff887f95e7b566b36faf97d457372c04c213.tar.gz cpython-18c3ff887f95e7b566b36faf97d457372c04c213.tar.bz2 |
Make it an error to compare a bytes object and a Unicode object.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_bytes.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index b7e6800..1c161bb 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -130,12 +130,12 @@ class BytesTest(unittest.TestCase): self.assertEqual(str8("abc") < b"ab", False) self.assertEqual(str8("abc") <= b"ab", False) - # Bytes should never compare equal to Unicode! + # Bytes can't be compared to Unicode! # Test this for all expected byte orders and Unicode character sizes - self.assertEqual(b"\0a\0b\0c" == "abc", False) - self.assertEqual(b"\0\0\0a\0\0\0b\0\0\0c" == "abc", False) - self.assertEqual(b"a\0b\0c\0" == "abc", False) - self.assertEqual(b"a\0\0\0b\0\0\0c\0\0\0" == "abc", False) + self.assertRaises(TypeError, lambda: b"\0a\0b\0c" == "abc") + self.assertRaises(TypeError, lambda: b"\0\0\0a\0\0\0b\0\0\0c" == "abc") + self.assertRaises(TypeError, lambda: b"a\0b\0c\0" == "abc") + self.assertRaises(TypeError, lambda: b"a\0\0\0b\0\0\0c\0\0\0" == "abc") def test_nohash(self): self.assertRaises(TypeError, hash, bytes()) |