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