diff options
author | Guido van Rossum <guido@python.org> | 2007-05-08 21:05:48 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-08 21:05:48 +0000 |
commit | f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78 (patch) | |
tree | f2dd45d9585bc92e27c45e345fae3e906e3f2204 /Lib/test/test_builtin.py | |
parent | 2b08b38deacc065b4fea8421528de1eed66d56b0 (diff) | |
download | cpython-f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78.tar.gz cpython-f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78.zip |
Given that ord() of a bytes object of length 1 is defined, it should
never return a negative number.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 58cb29ba87d..a11e40aa15b 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1383,6 +1383,15 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(ord(' '), 32) self.assertEqual(ord('A'), 65) self.assertEqual(ord('a'), 97) + self.assertEqual(ord('\x80'), 128) + self.assertEqual(ord('\xff'), 255) + + self.assertEqual(ord(b' '), 32) + self.assertEqual(ord(b'A'), 65) + self.assertEqual(ord(b'a'), 97) + self.assertEqual(ord(b'\x80'), 128) + self.assertEqual(ord(b'\xff'), 255) + if have_unicode: self.assertEqual(ord(chr(sys.maxunicode)), sys.maxunicode) self.assertRaises(TypeError, ord, 42) |