ยปCore Development>Code coverage>Lib/test/test_future_builtins.py

Python code coverage for Lib/test/test_future_builtins.py

#countcontent
11import test.test_support, unittest
2n/a
3n/a# we're testing the behavior of these future builtins:
41from future_builtins import hex, oct, map, zip, filter
5n/a
62class BuiltinTest(unittest.TestCase):
71 def test_hex(self):
81 self.assertEqual(hex(0), '0x0')
91 self.assertEqual(hex(16), '0x10')
101 self.assertEqual(hex(16L), '0x10')
111 self.assertEqual(hex(-16), '-0x10')
121 self.assertEqual(hex(-16L), '-0x10')
131 self.assertRaises(TypeError, hex, {})
14n/a
151 def test_oct(self):
161 self.assertEqual(oct(0), '0o0')
171 self.assertEqual(oct(100), '0o144')
181 self.assertEqual(oct(100L), '0o144')
191 self.assertEqual(oct(-100), '-0o144')
201 self.assertEqual(oct(-100L), '-0o144')
211 self.assertRaises(TypeError, oct, ())
22n/a
231 def test_itertools(self):
241 from itertools import imap, izip, ifilter
25n/a # We will assume that the itertools functions work, so provided
26n/a # that we've got identical coppies, we will work!
271 self.assertEqual(map, imap)
281 self.assertEqual(zip, izip)
291 self.assertEqual(filter, ifilter)
30n/a # Testing that filter(None, stuff) raises a warning lives in
31n/a # test_py3kwarn.py
32n/a
33n/a
341def test_main(verbose=None):
351 test.test_support.run_unittest(BuiltinTest)
36n/a
371if __name__ == "__main__":
380 test_main(verbose=True)