+++ /dev/null
-import test.test_support, unittest\r
-\r
-# we're testing the behavior of these future builtins:\r
-from future_builtins import hex, oct, map, zip, filter\r
-\r
-class BuiltinTest(unittest.TestCase):\r
- def test_hex(self):\r
- self.assertEqual(hex(0), '0x0')\r
- self.assertEqual(hex(16), '0x10')\r
- self.assertEqual(hex(16L), '0x10')\r
- self.assertEqual(hex(-16), '-0x10')\r
- self.assertEqual(hex(-16L), '-0x10')\r
- self.assertRaises(TypeError, hex, {})\r
-\r
- def test_oct(self):\r
- self.assertEqual(oct(0), '0o0')\r
- self.assertEqual(oct(100), '0o144')\r
- self.assertEqual(oct(100L), '0o144')\r
- self.assertEqual(oct(-100), '-0o144')\r
- self.assertEqual(oct(-100L), '-0o144')\r
- self.assertRaises(TypeError, oct, ())\r
-\r
- def test_itertools(self):\r
- from itertools import imap, izip, ifilter\r
- # We will assume that the itertools functions work, so provided\r
- # that we've got identical coppies, we will work!\r
- self.assertEqual(map, imap)\r
- self.assertEqual(zip, izip)\r
- self.assertEqual(filter, ifilter)\r
- # Testing that filter(None, stuff) raises a warning lives in\r
- # test_py3kwarn.py\r
-\r
-\r
-def test_main(verbose=None):\r
- test.test_support.run_unittest(BuiltinTest)\r
-\r
-if __name__ == "__main__":\r
- test_main(verbose=True)\r