annotate Lib/test/test_future3.py @ 80661:94de77bd0b4b 2.7

Issue #16194: document imp.load_dynamic problems when read several extension modules from the same binary object file.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Thu, 29 Nov 2012 19:51:28 +0200
parents 1a42b128c581
children 9c930a32cebb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19409
bc9c8cebc2ef Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
1 from __future__ import nested_scopes
bc9c8cebc2ef Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
2 from __future__ import division
29872
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
3
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
4 import unittest
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
5 from test import test_support
19409
bc9c8cebc2ef Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
6
29872
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
7 x = 2
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
8 def nester():
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
9 x = 3
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
10 def inner():
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
11 return x
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
12 return inner()
19409
bc9c8cebc2ef Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
13
bc9c8cebc2ef Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
14
29872
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
15 class TestFuture(unittest.TestCase):
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
16
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
17 def test_floor_div_operator(self):
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
18 self.assertEqual(7 // 2, 3)
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
19
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
20 def test_true_div_as_default(self):
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
21 self.assertAlmostEqual(7 / 2, 3.5)
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
22
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
23 def test_nested_scopes(self):
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
24 self.assertEqual(nester(), 3)
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
25
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
26 def test_main():
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
27 test_support.run_unittest(TestFuture)
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
28
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
29 if __name__ == "__main__":
1a42b128c581 Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents: 19409
diff changeset
30 test_main()