Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Side by Side Diff: Lib/test/test_structseq.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 7 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_strptime.py ('k') | Lib/test/test_symtable.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os 1 import os
2 import time 2 import time
3 import unittest 3 import unittest
4 from test import support 4 from test import support
5 5
6 6
7 class StructSeqTest(unittest.TestCase): 7 class StructSeqTest(unittest.TestCase):
8 8
9 def test_tuple(self): 9 def test_tuple(self):
10 t = time.gmtime() 10 t = time.gmtime()
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 self.assertNotIn(-42, t1) 63 self.assertNotIn(-42, t1)
64 64
65 def test_hash(self): 65 def test_hash(self):
66 t1 = time.gmtime() 66 t1 = time.gmtime()
67 self.assertEqual(hash(t1), hash(tuple(t1))) 67 self.assertEqual(hash(t1), hash(tuple(t1)))
68 68
69 def test_cmp(self): 69 def test_cmp(self):
70 t1 = time.gmtime() 70 t1 = time.gmtime()
71 t2 = type(t1)(t1) 71 t2 = type(t1)(t1)
72 self.assertEqual(t1, t2) 72 self.assertEqual(t1, t2)
73 self.assertTrue(not (t1 < t2)) 73 self.assertFalse(t1 < t2)
74 self.assertTrue(t1 <= t2) 74 self.assertTrue(t1 <= t2)
75 self.assertTrue(not (t1 > t2)) 75 self.assertFalse(t1 > t2)
76 self.assertTrue(t1 >= t2) 76 self.assertTrue(t1 >= t2)
77 self.assertTrue(not (t1 != t2)) 77 self.assertFalse(t1 != t2)
78 78
79 def test_fields(self): 79 def test_fields(self):
80 t = time.gmtime() 80 t = time.gmtime()
81 self.assertEqual(len(t), t.n_sequence_fields) 81 self.assertEqual(len(t), t.n_sequence_fields)
82 self.assertEqual(t.n_unnamed_fields, 0) 82 self.assertEqual(t.n_unnamed_fields, 0)
83 self.assertEqual(t.n_fields, time._STRUCT_TM_ITEMS) 83 self.assertEqual(t.n_fields, time._STRUCT_TM_ITEMS)
84 84
85 def test_constructor(self): 85 def test_constructor(self):
86 t = time.struct_time 86 t = time.struct_time
87 87
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 # Skip step 0 (invalid) 121 # Skip step 0 (invalid)
122 for step in indices[1:]: 122 for step in indices[1:]:
123 self.assertEqual(list(t[start:stop:step]), 123 self.assertEqual(list(t[start:stop:step]),
124 L[start:stop:step]) 124 L[start:stop:step])
125 125
126 def test_main(): 126 def test_main():
127 support.run_unittest(StructSeqTest) 127 support.run_unittest(StructSeqTest)
128 128
129 if __name__ == "__main__": 129 if __name__ == "__main__":
130 test_main() 130 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_strptime.py ('k') | Lib/test/test_symtable.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+