mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user