Walter Dörwald | 1dde95d | 2003-12-08 11:38:45 +0000 | [diff] [blame^] | 1 | import unittest |
| 2 | from test import test_support, list_tests |
| 3 | |
| 4 | class ListTest(list_tests.CommonTest): |
| 5 | type2test = list |
| 6 | |
| 7 | def test_truth(self): |
| 8 | super(ListTest, self).test_truth() |
| 9 | self.assert_(not []) |
| 10 | self.assert_([42]) |
| 11 | |
| 12 | def test_identity(self): |
| 13 | self.assert_([] is not []) |
| 14 | |
| 15 | def test_len(self): |
| 16 | super(ListTest, self).test_len() |
| 17 | self.assertEqual(len([]), 0) |
| 18 | self.assertEqual(len([0]), 1) |
| 19 | self.assertEqual(len([0, 1, 2]), 3) |
| 20 | |
| 21 | def test_main(): |
| 22 | test_support.run_unittest(ListTest) |
| 23 | |
| 24 | if __name__=="__main__": |
| 25 | test_main() |