Skip to content

Commit 5c3e4a5

Browse files
committed
add tests
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 76c0581 commit 5c3e4a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lib/test/test_structseq.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,28 @@ def test_match_args_with_unnamed_fields(self):
133133
self.assertEqual(os.stat_result.n_unnamed_fields, 3)
134134
self.assertEqual(os.stat_result.__match_args__, expected_args)
135135

136+
def test_tuple_field_keys(self):
137+
expected_keys = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',
138+
'tm_sec', 'tm_wday', 'tm_yday', 'tm_isdst')
139+
self.assertEqual(time.gmtime()._fields, time.struct_time._fields, expected_keys)
140+
141+
def test_tuple_field_defaults(self):
142+
self.assertEqual(time.gmtime()._field_defaults, time.struct_time._field_defaults, {})
143+
144+
def test_tuple_asdict(self):
145+
t = time.gmtime(0)
146+
self.assertEqual(t._asdict(), {
147+
'tm_year': 1970,
148+
'tm_mon': 1,
149+
'tm_mday': 1,
150+
'tm_hour': 0,
151+
'tm_min': 0,
152+
'tm_sec': 0,
153+
'tm_wday': 3,
154+
'tm_yday': 1,
155+
'tm_isdst': 0,
156+
})
157+
136158

137159
if __name__ == "__main__":
138160
unittest.main()

0 commit comments

Comments
 (0)