diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-03-04 00:03:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 00:03:44 (GMT) |
commit | 0632b1012d4dfa81ffef0d686a4710f6134f77a8 (patch) | |
tree | b1387749144a2ba1582fbb9023fdc4ddbdb6c3aa /Lib/test/test_structseq.py | |
parent | 9c7927400cd8f1d283bf7915b6b33fea81b8655d (diff) | |
download | cpython-0632b1012d4dfa81ffef0d686a4710f6134f77a8.zip cpython-0632b1012d4dfa81ffef0d686a4710f6134f77a8.tar.gz cpython-0632b1012d4dfa81ffef0d686a4710f6134f77a8.tar.bz2 |
bpo-42128: Add __match_args__ to structseq-based classes (GH-24732)
Diffstat (limited to 'Lib/test/test_structseq.py')
-rw-r--r-- | Lib/test/test_structseq.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py index 36630a1..a9fe193 100644 --- a/Lib/test/test_structseq.py +++ b/Lib/test/test_structseq.py @@ -122,5 +122,17 @@ class StructSeqTest(unittest.TestCase): self.assertEqual(list(t[start:stop:step]), L[start:stop:step]) + def test_match_args(self): + expected_args = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min', + 'tm_sec', 'tm_wday', 'tm_yday', 'tm_isdst') + self.assertEqual(time.struct_time.__match_args__, expected_args) + + def test_match_args_with_unnamed_fields(self): + expected_args = ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid', + 'st_gid', 'st_size') + self.assertEqual(os.stat_result.n_unnamed_fields, 3) + self.assertEqual(os.stat_result.__match_args__, expected_args) + + if __name__ == "__main__": unittest.main() |