Skip to content

Commit 93060c0

Browse files
committed
Add a match test to test_unparse
1 parent 9b79360 commit 93060c0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lib/test/test_unparse.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,24 @@ def test_unparse_interactive_integrity_3(self):
684684

685685
self.check_src_roundtrip(src, out, mode='single')
686686

687+
@test.support.subTests('case', [
688+
"case 'a string':",
689+
"case True:",
690+
"case _:",
691+
"case [*_]:",
692+
"case tuple():",
693+
"case cls(arg, more=arg2):",
694+
"case tuple() | list():",
695+
"case [tuple() as obj, _, {'a': a, **more}]:",
696+
"case -2:",
697+
"case +2:",
698+
"case 2 + 3j:",
699+
"case +2 - 3j:",
700+
])
701+
def test_unparse_match(self, case):
702+
src = 'match x:\n ' + case + '\n pass'
703+
self.check_src_roundtrip(src)
704+
687705

688706
class CosmeticTestCase(ASTTestCase):
689707
"""Test if there are cosmetic issues caused by unnecessary additions"""

0 commit comments

Comments
 (0)