Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_future3.py @ 64166:d0e9febfa00a 3.1
Merged revisions 84172 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84172 | martin.v.loewis | 2010-08-18 18:12:23 +0200 (Mi, 18 Aug 2010) | 2 lines
Restore GIL in nis_cat in case of error.
........
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 19 Aug 2010 09:03:03 +0000 |
| parents | 9c930a32cebb |
| children | 83ae10bf608c |
| 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 |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
29872
diff
changeset
|
5 from test import 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(): |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
29872
diff
changeset
|
27 support.run_unittest(TestFuture) |
|
29872
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() |
