@@ -70,10 +70,18 @@ class TestAssertionRewrite(object):
70
70
def test_place_initial_imports (self ):
71
71
s = """'Doc string'\n other = stuff"""
72
72
m = rewrite (s )
73
- # Module docstrings in 3.7 are part of Module node, it's not in the body
73
+ # Module docstrings in 3.8 are part of Module node, it's not in the body
74
74
# so we remove it so the following body items have the same indexes on
75
75
# all Python versions
76
- if sys .version_info < (3 , 7 ):
76
+ # This was briefly in 3.7 as well but got reverted in beta 5
77
+ # TODO:
78
+ # We have a complicated sys.version_info if in here to ease testing on
79
+ # various Python 3.7 versions, but we should remove the 3.7 check after
80
+ # 3.7 is released as stable
81
+ if (
82
+ sys .version_info < (3 , 8 )
83
+ or (3 , 7 ) <= sys .version_info <= (3 , 7 , 0 , "beta" , 4 )
84
+ ):
77
85
assert isinstance (m .body [0 ], ast .Expr )
78
86
assert isinstance (m .body [0 ].value , ast .Str )
79
87
del m .body [0 ]
@@ -92,7 +100,10 @@ def test_place_initial_imports(self):
92
100
assert isinstance (m .body [3 ], ast .Expr )
93
101
s = """'doc string'\n from __future__ import with_statement"""
94
102
m = rewrite (s )
95
- if sys .version_info < (3 , 7 ):
103
+ if (
104
+ sys .version_info < (3 , 8 )
105
+ or (3 , 7 ) <= sys .version_info <= (3 , 7 , 0 , "beta" , 4 )
106
+ ):
96
107
assert isinstance (m .body [0 ], ast .Expr )
97
108
assert isinstance (m .body [0 ].value , ast .Str )
98
109
del m .body [0 ]
@@ -103,7 +114,10 @@ def test_place_initial_imports(self):
103
114
assert imp .col_offset == 0
104
115
s = """'doc string'\n from __future__ import with_statement\n other"""
105
116
m = rewrite (s )
106
- if sys .version_info < (3 , 7 ):
117
+ if (
118
+ sys .version_info < (3 , 8 )
119
+ or (3 , 7 ) <= sys .version_info <= (3 , 7 , 0 , "beta" , 4 )
120
+ ):
107
121
assert isinstance (m .body [0 ], ast .Expr )
108
122
assert isinstance (m .body [0 ].value , ast .Str )
109
123
del m .body [0 ]
@@ -124,7 +138,10 @@ def test_place_initial_imports(self):
124
138
def test_dont_rewrite (self ):
125
139
s = """'PYTEST_DONT_REWRITE'\n assert 14"""
126
140
m = rewrite (s )
127
- if sys .version_info < (3 , 7 ):
141
+ if (
142
+ sys .version_info < (3 , 8 )
143
+ or (3 , 7 ) <= sys .version_info <= (3 , 7 , 0 , "beta" , 4 )
144
+ ):
128
145
assert len (m .body ) == 2
129
146
assert isinstance (m .body [0 ], ast .Expr )
130
147
assert isinstance (m .body [0 ].value , ast .Str )
0 commit comments