Add better error reporting for MemoryErrors caused by str->float conversions.
[python.git] / Lib / test / test_future_builtins.py
blob0e16caf5d02cc4515f1d1926aba775559f68fa4a
1 import test.test_support, unittest
3 # we're testing the behavior of these future builtins:
4 from future_builtins import hex, oct, map, zip, filter
5 from test import test_support
7 class BuiltinTest(unittest.TestCase):
8 def test_hex(self):
9 self.assertEqual(hex(0), '0x0')
10 self.assertEqual(hex(16), '0x10')
11 self.assertEqual(hex(16L), '0x10')
12 self.assertEqual(hex(-16), '-0x10')
13 self.assertEqual(hex(-16L), '-0x10')
14 self.assertRaises(TypeError, hex, {})
16 def test_oct(self):
17 self.assertEqual(oct(0), '0o0')
18 self.assertEqual(oct(100), '0o144')
19 self.assertEqual(oct(100L), '0o144')
20 self.assertEqual(oct(-100), '-0o144')
21 self.assertEqual(oct(-100L), '-0o144')
22 self.assertRaises(TypeError, oct, ())
24 def test_itertools(self):
25 from itertools import imap, izip, ifilter
26 # We will assume that the itertools functions work, so provided
27 # that we've got identical coppies, we will work!
28 self.assertEqual(map, imap)
29 self.assertEqual(zip, izip)
30 self.assertEqual(filter, ifilter)
31 # Testing that filter(None, stuff) raises a warning lives in
32 # test_py3kwarn.py
35 def test_main(verbose=None):
36 test.test_support.run_unittest(BuiltinTest)
38 if __name__ == "__main__":
39 test_main(verbose=True)