]> git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_undocumented_details.py
AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python...
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_undocumented_details.py
1 from test.test_support import run_unittest, check_py3k_warnings
2 import unittest
3
4 class TestImplementationComparisons(unittest.TestCase):
5
6 def test_type_comparisons(self):
7 self.assertTrue(str < int or str > int)
8 self.assertTrue(int <= str or int >= str)
9 self.assertTrue(cmp(int, str) != 0)
10 self.assertTrue(int is int)
11 self.assertTrue(str == str)
12 self.assertTrue(int != str)
13
14 def test_cell_comparisons(self):
15 def f(x):
16 if x:
17 y = 1
18 def g():
19 return x
20 def h():
21 return y
22 return g, h
23 g, h = f(0)
24 g_cell, = g.func_closure
25 h_cell, = h.func_closure
26 self.assertTrue(h_cell < g_cell)
27 self.assertTrue(g_cell >= h_cell)
28 self.assertEqual(cmp(g_cell, h_cell), 1)
29 self.assertTrue(g_cell is g_cell)
30 self.assertTrue(g_cell == g_cell)
31 self.assertTrue(h_cell == h_cell)
32 self.assertTrue(g_cell != h_cell)
33
34 def test_main():
35 with check_py3k_warnings():
36 run_unittest(TestImplementationComparisons)
37
38 if __name__ == '__main__':
39 test_main()