4141import inspect
4242
4343
44- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
4544def test_guard ():
4645 def f (x , g ):
4746 match x :
@@ -63,7 +62,6 @@ def f(x):
6362 assert f (1 ) == 42
6463 assert f (2 ) == 0
6564
66- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
6765def test_complex_as_binary_op ():
6866 src = """
6967def f(a):
@@ -88,8 +86,6 @@ def f(a):
8886 assert f (6 + 3j ) == "match add"
8987 assert f (- 2 - 3j ) == "match sub"
9088
91- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
92- @unittest .skipIf (os .environ .get ('BYTECODE_DSL_INTERPRETER' ), "TODO: mapping pattern matching" )
9389def test_long_mapping ():
9490 def f (x ):
9591 match d :
@@ -108,7 +104,6 @@ def star_match(x):
108104
109105 assert star_match (d ) == {33 :33 }
110106
111- @unittest .skipIf (os .environ .get ('BYTECODE_DSL_INTERPRETER' ), "TODO: mapping pattern matching" )
112107def test_mutable_dict_keys ():
113108 class MyObj :
114109 pass
@@ -127,7 +122,6 @@ def test(name):
127122 assert test ('attr1' ) == {'dyn_match' : 1 , 'attr2' : 2 , 'attr3' : 3 }
128123 assert test ('attr2' ) == {'dyn_match' : 2 , 'attr1' : 1 , 'attr3' : 3 }
129124
130- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
131125def test_multiple_or_pattern_basic ():
132126 match 0 :
133127 case 0 | 1 | 2 | 3 | 4 | 5 as x :
@@ -137,7 +131,6 @@ def test_multiple_or_pattern_basic():
137131 case ((0 | 1 | 2 ) as x ) | ((3 | 4 | 5 ) as x ):
138132 assert x == 3
139133
140- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
141134def test_sequence_pattern ():
142135 match (1 , 2 ):
143136 case (3 , 2 ):
@@ -152,7 +145,6 @@ def test_sequence_pattern():
152145 assert False
153146
154147
155- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
156148def test_multiple_or_pattern_advanced ():
157149 match 4 :
158150 case (0 as z ) | (1 as z ) | (2 as z ) | (4 as z ) | (77 as z ):
@@ -187,7 +179,6 @@ def test_multiple_or_pattern_advanced():
187179 assert w == 1
188180
189181
190- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
191182def test_multiple_or_pattern_creates_locals ():
192183 match (1 , 2 ):
193184 case (a , 1 ) | (a , 2 ):
@@ -238,39 +229,34 @@ def assert_syntax_error(self, code: str):
238229 with self .assertRaises (SyntaxError ):
239230 compile (inspect .cleandoc (code ), "<test>" , "exec" )
240231
241- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
242232 def test_alternative_patterns_bind_different_names_0 (self ):
243233 self .assert_syntax_error ("""
244234 match ...:
245235 case "a" | a:
246236 pass
247237 """ )
248238
249- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
250239 def test_alternative_patterns_bind_different_names_1 (self ):
251240 self .assert_syntax_error ("""
252241 match ...:
253242 case [a, [b] | [c] | [d]]:
254243 pass
255244 """ )
256245
257- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
258246 def test_multiple_or_same_name (self ):
259247 self .assert_syntax_error ("""
260248 match 0:
261249 case x | x:
262250 pass
263251 """ )
264252
265- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
266253 def test_multiple_or_wildcard (self ):
267254 self .assert_syntax_error ("""
268255 match 0:
269256 case * | 1:
270257 pass
271258 """ )
272259
273- @unittest .skipIf (sys .version_info .minor < 10 , "Requires Python 3.10+" )
274260 def test_unbound_local_variable (self ):
275261 with self .assertRaises (UnboundLocalError ):
276262 match (1 , 3 ):
0 commit comments