diff options
Diffstat (limited to 'Lib/test/test_py3kwarn.py')
-rw-r--r-- | Lib/test/test_py3kwarn.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 2c8f509e60..e6d38f2ca7 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -123,6 +123,20 @@ class TestPy3KWarnings(unittest.TestCase): with catch_warning() as w: self.assertWarning(buffer('a'), w, expected) + def test_hex_and_oct(self): + class Spam(object): + def __hex__(self): return "0x17" + def __oct__(self): return "07" + + expected = 'In 3.x, oct() converts the result of __index__ to octal; ' \ + 'Use future_builtins.oct for this behavior. ' \ + 'Also, note the returned format is different.' + with catch_warning() as w: + self.assertWarning(oct(Spam()), w, expected) + expected = 'In 3.x, hex() converts the result of __index__ to hexidecimal.' + with catch_warning() as w: + self.assertWarning(hex(Spam()), w, expected) + class TestStdlibRemovals(unittest.TestCase): |