@@ -192,7 +192,7 @@ def test_constructors():
192
192
"""C++ default and converting constructors are equivalent to type calls in Python"""
193
193
types = [bytes , str , bool , int , float , tuple , list , dict , set ]
194
194
expected = {t .__name__ : t () for t in types }
195
- if pytest .PY2 :
195
+ if env .PY2 :
196
196
# Note that bytes.__name__ == 'str' in Python 2.
197
197
# pybind11::str is unicode even under Python 2.
198
198
expected ["bytes" ] = bytes ()
@@ -213,7 +213,7 @@ def test_constructors():
213
213
}
214
214
inputs = {k .__name__ : v for k , v in data .items ()}
215
215
expected = {k .__name__ : k (v ) for k , v in data .items ()}
216
- if pytest .PY2 : # Similar to the above. See comments above.
216
+ if env .PY2 : # Similar to the above. See comments above.
217
217
inputs ["bytes" ] = b'41'
218
218
inputs ["str" ] = 42
219
219
expected ["bytes" ] = b'41'
@@ -256,19 +256,19 @@ def test_pybind11_str_raw_str():
256
256
valid_orig = u"DZ"
257
257
valid_utf8 = valid_orig .encode ("utf-8" )
258
258
valid_cvt = cvt (valid_utf8 )
259
- assert type (valid_cvt ) is unicode if pytest .PY2 else str # noqa: F821
260
- if pytest .PY2 :
259
+ assert type (valid_cvt ) is unicode if env .PY2 else str # noqa: F821
260
+ if env .PY2 :
261
261
assert valid_cvt == valid_orig
262
262
else :
263
263
assert valid_cvt == u"b'\\ xc7\\ xb1'"
264
264
265
265
malformed_utf8 = b'\x80 '
266
- if pytest .PY2 :
266
+ if env .PY2 :
267
267
with pytest .raises (UnicodeDecodeError ):
268
268
cvt (malformed_utf8 )
269
269
else :
270
270
malformed_cvt = cvt (malformed_utf8 )
271
- assert type (malformed_cvt ) is unicode if pytest .PY2 else str # noqa: F821
271
+ assert type (malformed_cvt ) is unicode if env .PY2 else str # noqa: F821
272
272
assert malformed_cvt == u"b'\\ x80'"
273
273
274
274
0 commit comments