@@ -19,6 +19,9 @@ def remove_brackets(source):
1919
2020def test_exception_brackets ():
2121 """This is a buitin so remove the brackets"""
22+ if sys .version_info < (3 , 0 ):
23+ pytest .skip ('transform does not work in this version of python' )
24+
2225 source = 'def a(): raise Exception()'
2326 expected = 'def a(): raise Exception'
2427
@@ -28,6 +31,9 @@ def test_exception_brackets():
2831
2932def test_zero_division_error_brackets ():
3033 """This is a buitin so remove the brackets"""
34+ if sys .version_info < (3 , 0 ):
35+ pytest .skip ('transform does not work in this version of python' )
36+
3137 source = 'def a(): raise ZeroDivisionError()'
3238 expected = 'def a(): raise ZeroDivisionError'
3339
@@ -37,6 +43,9 @@ def test_zero_division_error_brackets():
3743
3844def test_builtin_with_arg ():
3945 """This has an arg so dont' remove the brackets"""
46+ if sys .version_info < (3 , 0 ):
47+ pytest .skip ('transform does not work in this version of python' )
48+
4049 source = 'def a(): raise Exception(1)'
4150 expected = 'def a(): raise Exception(1)'
4251
@@ -46,6 +55,9 @@ def test_builtin_with_arg():
4655
4756def test_one_division_error_brackets ():
4857 """This is not a builtin so don't remove the brackets even though it's not defined in the module"""
58+ if sys .version_info < (3 , 0 ):
59+ pytest .skip ('transform does not work in this version of python' )
60+
4961 source = 'def a(): raise OneDivisionError()'
5062 expected = source
5163
@@ -55,6 +67,9 @@ def test_one_division_error_brackets():
5567
5668def test_redefined ():
5769 """This is usually a builtin, but don't remove brackets if it's been redefined"""
70+ if sys .version_info < (3 , 0 ):
71+ pytest .skip ('transform does not work in this version of python' )
72+
5873 source = '''
5974def a():
6075 raise ZeroDivisionError()
@@ -77,6 +92,7 @@ def test_raise_from():
7792 """This is a builtin so remove the brackets"""
7893 if sys .version_info < (3 , 0 ):
7994 pytest .skip ('raise from not supported in this version of python' )
95+
8096 source = 'def a(): raise Exception() from Exception()'
8197 expected = 'def a(): raise Exception from Exception'
8298
0 commit comments