diff options
Diffstat (limited to 'sources/pyside2/tests')
| -rw-r--r-- | sources/pyside2/tests/registry/init_platform.py | 6 | ||||
| -rw-r--r-- | sources/pyside2/tests/support/voidptr_test.py | 18 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py index 6031dd2ad..a324c36a2 100644 --- a/sources/pyside2/tests/registry/init_platform.py +++ b/sources/pyside2/tests/registry/init_platform.py @@ -55,8 +55,7 @@ shiboken and pysidetest projects. import sys import os import re -# PYSIDE-953: Use a newer contextlib for Python 3.5 -# from contextlib import contextmanager +from contextlib import contextmanager from textwrap import dedent script_dir = os.path.normpath(os.path.join(__file__, *".. .. .. .. ..".split())) @@ -118,9 +117,6 @@ sys.path[:0] = [os.path.join(shiboken_build_dir, "shibokenmodule"), pyside_build_dir] import PySide2 -# PYSIDE-953: Use a newer contextlib for Python 3.5 -import PySide2.support.signature # new contextlib -from contextlib import contextmanager all_modules = list("PySide2." + x for x in PySide2.__all__) diff --git a/sources/pyside2/tests/support/voidptr_test.py b/sources/pyside2/tests/support/voidptr_test.py index 330788c63..c04022489 100644 --- a/sources/pyside2/tests/support/voidptr_test.py +++ b/sources/pyside2/tests/support/voidptr_test.py @@ -38,9 +38,21 @@ class PySide2Support(unittest.TestCase): # a C++ object, a wrapped Shiboken Object type, # an object implementing the Python Buffer interface, # or another VoidPtr object. - ba = QByteArray(b"Hello world") - voidptr = VoidPtr(ba) - self.assertIsInstance(voidptr, shiboken.VoidPtr) + + # Original content + b = b"Hello world" + ba = QByteArray(b) + vp = VoidPtr(ba, ba.size()) + self.assertIsInstance(vp, shiboken.VoidPtr) + + # Create QByteArray from voidptr byte interpretation + nba = QByteArray.fromRawData(vp.toBytes()) + # Compare original bytes to toBytes() + self.assertTrue(b, vp.toBytes()) + # Compare original with new QByteArray data + self.assertTrue(b, nba.data()) + # Convert original and new to str + self.assertTrue(str(b), str(nba)) if __name__ == '__main__': unittest.main() |
