tests: Consolidate version (2 vs. 3) and platform (CPython vs. PyPy) checks (#2376)

Fix logic in test_bytes_to_string

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Eric Cousineau
2020-08-14 14:03:43 -04:00
committed by GitHub
parent cba4a98546
commit ebdd0d368c
6 changed files with 35 additions and 35 deletions

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import pytest
import sys
from pybind11_tests import stl_binders as m
with pytest.suppress(ImportError):
@@ -77,7 +76,7 @@ def test_vector_buffer():
assert v[1] == 2
v[2] = 5
mv = memoryview(v) # We expose the buffer interface
if sys.version_info.major > 2:
if not pytest.PY2:
assert mv[2] == 5
mv[2] = 6
else:
@@ -85,7 +84,7 @@ def test_vector_buffer():
mv[2] = '\x06'
assert v[2] == 6
if sys.version_info.major > 2:
if not pytest.PY2:
mv = memoryview(b)
v = m.VectorUChar(mv[::2])
assert v[1] == 3