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
6 class BuiltinTest(unittest
.TestCase
):
8 self
.assertEqual(hex(0), '0x0')
9 self
.assertEqual(hex(16), '0x10')
10 self
.assertEqual(hex(16L), '0x10')
11 self
.assertEqual(hex(-16), '-0x10')
12 self
.assertEqual(hex(-16L), '-0x10')
13 self
.assertRaises(TypeError, hex, {})
16 self
.assertEqual(oct(0), '0o0')
17 self
.assertEqual(oct(100), '0o144')
18 self
.assertEqual(oct(100L), '0o144')
19 self
.assertEqual(oct(-100), '-0o144')
20 self
.assertEqual(oct(-100L), '-0o144')
21 self
.assertRaises(TypeError, oct, ())
23 def test_itertools(self
):
24 from itertools
import imap
, izip
, ifilter
25 # We will assume that the itertools functions work, so provided
26 # that we've got identical coppies, we will work!
27 self
.assertEqual(map, imap
)
28 self
.assertEqual(zip, izip
)
29 self
.assertEqual(filter, ifilter
)
30 # Testing that filter(None, stuff) raises a warning lives in
34 def test_main(verbose
=None):
35 test
.test_support
.run_unittest(BuiltinTest
)
37 if __name__
== "__main__":
38 test_main(verbose
=True)