Skip to content

Commit a48976f

Browse files
YannickJadoulrwgk
authored andcommitted
Fix tests after #2397 changed pytest.PY2 to env.PY2
1 parent 61882fb commit a48976f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_pytypes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_constructors():
192192
"""C++ default and converting constructors are equivalent to type calls in Python"""
193193
types = [bytes, str, bool, int, float, tuple, list, dict, set]
194194
expected = {t.__name__: t() for t in types}
195-
if pytest.PY2:
195+
if env.PY2:
196196
# Note that bytes.__name__ == 'str' in Python 2.
197197
# pybind11::str is unicode even under Python 2.
198198
expected["bytes"] = bytes()
@@ -213,7 +213,7 @@ def test_constructors():
213213
}
214214
inputs = {k.__name__: v for k, v in data.items()}
215215
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.
217217
inputs["bytes"] = b'41'
218218
inputs["str"] = 42
219219
expected["bytes"] = b'41'
@@ -256,19 +256,19 @@ def test_pybind11_str_raw_str():
256256
valid_orig = u"DZ"
257257
valid_utf8 = valid_orig.encode("utf-8")
258258
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:
261261
assert valid_cvt == valid_orig
262262
else:
263263
assert valid_cvt == u"b'\\xc7\\xb1'"
264264

265265
malformed_utf8 = b'\x80'
266-
if pytest.PY2:
266+
if env.PY2:
267267
with pytest.raises(UnicodeDecodeError):
268268
cvt(malformed_utf8)
269269
else:
270270
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
272272
assert malformed_cvt == u"b'\\x80'"
273273

274274

0 commit comments

Comments
 (0)