Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_future3.py @ 84007:dbfbdf2b5c19 3.3
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.
| author | Senthil Kumaran <senthil@uthcode.com> |
|---|---|
| date | Sat, 01 Jun 2013 08:27:06 -0700 |
| parents | 83ae10bf608c |
| children |
| 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 |
|
19409
bc9c8cebc2ef
Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
5 |
|
29872
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
6 x = 2 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
7 def nester(): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
8 x = 3 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
9 def inner(): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
10 return x |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
11 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
|
12 |
|
bc9c8cebc2ef
Add test case to cover multiple future statements on separate lines of
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
13 |
|
29872
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
14 class TestFuture(unittest.TestCase): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
15 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
16 def test_floor_div_operator(self): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
17 self.assertEqual(7 // 2, 3) |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
18 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
19 def test_true_div_as_default(self): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
20 self.assertAlmostEqual(7 / 2, 3.5) |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
21 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
22 def test_nested_scopes(self): |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
23 self.assertEqual(nester(), 3) |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
24 |
|
1a42b128c581
Fixed test and converted to unittest format.
Raymond Hettinger <python@rcn.com>
parents:
19409
diff
changeset
|
25 if __name__ == "__main__": |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
47201
diff
changeset
|
26 unittest.main() |
