PageRenderTime 403ms CodeModel.GetById 221ms app.highlight 2ms RepoModel.GetById 179ms app.codeStats 0ms

/Lib/test/test_future3.py

http://unladen-swallow.googlecode.com/
Python | 30 lines | 21 code | 9 blank | 0 comment | 1 complexity | 5ff7476f76019678c798af3489041e4b MD5 | raw file
 1from __future__ import nested_scopes
 2from __future__ import division
 3
 4import unittest
 5from test import test_support
 6
 7x = 2
 8def nester():
 9    x = 3
10    def inner():
11        return x
12    return inner()
13
14
15class TestFuture(unittest.TestCase):
16
17    def test_floor_div_operator(self):
18        self.assertEqual(7 // 2, 3)
19
20    def test_true_div_as_default(self):
21        self.assertAlmostEqual(7 / 2, 3.5)
22
23    def test_nested_scopes(self):
24        self.assertEqual(nester(), 3)
25
26def test_main():
27    test_support.run_unittest(TestFuture)
28
29if __name__ == "__main__":
30    test_main()