Lib/test/test_future_stmt/test_future_single_import.py
raw| 1 | from __future__ import nested_scopes |
| 2 | from __future__ import division |
| 3 | |
| 4 | import unittest |
| 5 | |
| 6 | x = 2 |
| 7 | def nester(): |
| 8 | x = 3 |
| 9 | def inner(): |
| 10 | return x |
| 11 | return inner() |
| 12 | |
| 13 | |
| 14 | class TestFuture(unittest.TestCase): |
| 15 | |
| 16 | def test_floor_div_operator(self): |
| 17 | self.assertEqual(7 // 2, 3) |
| 18 | |
| 19 | def test_true_div_as_default(self): |
| 20 | self.assertAlmostEqual(7 / 2, 3.5) |
| 21 | |
| 22 | def test_nested_scopes(self): |
| 23 | self.assertEqual(nester(), 3) |
| 24 | |
| 25 | if __name__ == "__main__": |
| 26 | unittest.main() |