diff options
author | Guido van Rossum <guido@python.org> | 2003-11-29 23:52:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-11-29 23:52:13 (GMT) |
commit | 6c9e130524533263b690e86639a36b6f3e7a8eeb (patch) | |
tree | 39023f825688f630245ddcaa60af9942a859522c /Lib/test/test_hexoct.py | |
parent | 37e136373e0d9ab3bdf25ecd9c42b86281ed21d3 (diff) | |
download | cpython-6c9e130524533263b690e86639a36b6f3e7a8eeb.zip cpython-6c9e130524533263b690e86639a36b6f3e7a8eeb.tar.gz cpython-6c9e130524533263b690e86639a36b6f3e7a8eeb.tar.bz2 |
- Removed FutureWarnings related to hex/oct literals and conversions
and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
This addresses most of the remaining semantic changes promised by
PEP 237, except for repr() of a long, which still shows the trailing
'L'. The PEP appears to promise warnings for operations that
changed semantics compared to Python 2.3, but this is not
implemented; we've suffered through enough warnings related to
hex/oct literals and I think it's best to be silent now.
Diffstat (limited to 'Lib/test/test_hexoct.py')
-rw-r--r-- | Lib/test/test_hexoct.py | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/Lib/test/test_hexoct.py b/Lib/test/test_hexoct.py index 8a57906..f71dbe0 100644 --- a/Lib/test/test_hexoct.py +++ b/Lib/test/test_hexoct.py @@ -1,8 +1,6 @@ """Test correct treatment of hex/oct constants. This is complex because of changes due to PEP 237. - -Some of these tests will have to change in Python 2.4! """ import sys @@ -41,31 +39,28 @@ class TextHexOct(unittest.TestCase): self.assertEqual(-0x7fffffffffffffff, -9223372036854775807) def test_hex_unsigned(self): - # This test is in a <string> so we can ignore the warnings - exec """if 1: if platform_long_is_32_bits: - # Positive-looking constants with negavive values - self.assertEqual(0x80000000, -2147483648L) - self.assertEqual(0xffffffff, -1) + # Positive constants + self.assertEqual(0x80000000, 2147483648L) + self.assertEqual(0xffffffff, 4294967295L) # Ditto with a minus sign and parentheses - self.assertEqual(-(0x80000000), 2147483648L) - self.assertEqual(-(0xffffffff), 1) + self.assertEqual(-(0x80000000), -2147483648L) + self.assertEqual(-(0xffffffff), -4294967295L) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-0x80000000, 2147483648L) - self.assertEqual(-0xffffffff, 1) + self.assertEqual(-0x80000000, -2147483648L) + self.assertEqual(-0xffffffff, -4294967295L) else: - # Positive-looking constants with negavive values - self.assertEqual(0x8000000000000000, -9223372036854775808L) - self.assertEqual(0xffffffffffffffff, -1) + # Positive constants + self.assertEqual(0x8000000000000000, 9223372036854775808L) + self.assertEqual(0xffffffffffffffff, 18446744073709551615L) # Ditto with a minus sign and parentheses - self.assertEqual(-(0x8000000000000000), 9223372036854775808L) - self.assertEqual(-(0xffffffffffffffff), 1) + self.assertEqual(-(0x8000000000000000), -9223372036854775808L) + self.assertEqual(-(0xffffffffffffffff), -18446744073709551615L) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-0x8000000000000000, 9223372036854775808L) - self.assertEqual(-0xffffffffffffffff, 1) - \n""" + self.assertEqual(-0x8000000000000000, -9223372036854775808L) + self.assertEqual(-0xffffffffffffffff, -18446744073709551615L) def test_oct_baseline(self): # Baseline tests @@ -91,31 +86,28 @@ class TextHexOct(unittest.TestCase): self.assertEqual(-0777777777777777777777, -9223372036854775807) def test_oct_unsigned(self): - # This test is in a <string> so we can ignore the warnings - exec """if 1: if platform_long_is_32_bits: - # Positive-looking constants with negavive values - self.assertEqual(020000000000, -2147483648L) - self.assertEqual(037777777777, -1) + # Positive constants + self.assertEqual(020000000000, 2147483648L) + self.assertEqual(037777777777, 4294967295L) # Ditto with a minus sign and parentheses - self.assertEqual(-(020000000000), 2147483648L) - self.assertEqual(-(037777777777), 1) + self.assertEqual(-(020000000000), -2147483648L) + self.assertEqual(-(037777777777), -4294967295L) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-020000000000, 2147483648L) - self.assertEqual(-037777777777, 1) + self.assertEqual(-020000000000, -2147483648L) + self.assertEqual(-037777777777, -4294967295L) else: - # Positive-looking constants with negavive values - self.assertEqual(01000000000000000000000, -9223372036854775808L) - self.assertEqual(01777777777777777777777, -1) + # Positive constants + self.assertEqual(01000000000000000000000, 9223372036854775808L) + self.assertEqual(01777777777777777777777, 18446744073709551615L) # Ditto with a minus sign and parentheses - self.assertEqual(-(01000000000000000000000), 9223372036854775808L) - self.assertEqual(-(01777777777777777777777), 1) + self.assertEqual(-(01000000000000000000000), -9223372036854775808L) + self.assertEqual(-(01777777777777777777777), -18446744073709551615L) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 - self.assertEqual(-01000000000000000000000, 9223372036854775808L) - self.assertEqual(-01777777777777777777777, 1) - \n""" + self.assertEqual(-01000000000000000000000, -9223372036854775808L) + self.assertEqual(-01777777777777777777777, -18446744073709551615L) def test_main(): test_support.run_unittest(TextHexOct) |