aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-08-28 21:36:28 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-08-29 09:32:15 +0200
commit940cad174f891a4b04af9bcc61aed1c8e8c6d4ae (patch)
tree5d4a39e0aa6991c20eb9b09c2a02c4b8a0385655 /sources/pyside6/tests
parent74a2ec0202af250828c10dfb10b71036a3af9dd8 (diff)
PySide6: Fix up QDataStream.readRawData/writeRawData()
writeRawData() was historically implemented to take a string. Fix the signature. Add an overload for PyBuffer/bytes. Fix the return type of readRawData() to be bytes. Fixes: PYSIDE-2442 Change-Id: I1684afd5aae2f8d118fa2fac87d916c23bd4a59e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/tests')
-rw-r--r--sources/pyside6/tests/QtCore/qdatastream_test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sources/pyside6/tests/QtCore/qdatastream_test.py b/sources/pyside6/tests/QtCore/qdatastream_test.py
index 9ec69076b..517f466aa 100644
--- a/sources/pyside6/tests/QtCore/qdatastream_test.py
+++ b/sources/pyside6/tests/QtCore/qdatastream_test.py
@@ -296,6 +296,16 @@ class QDataStreamBuffer(unittest.TestCase):
data = QDataStream(ba)
self.assertEqual(data.readRawData(4), bytes('AB\x00C', "UTF-8"))
+ def testRawDataBytes(self):
+ test_data = b'AB\0'
+ data = QDataStream()
+ ba = QByteArray()
+ data = QDataStream(ba, QIODevice.WriteOnly)
+ data.writeRawData(test_data)
+ self.assertEqual(ba.data(), test_data)
+ data = QDataStream(ba)
+ self.assertEqual(data.readRawData(3), test_data)
+
def testBytes(self):
dataOne = QDataStream()
self.assertEqual(dataOne.readBytes(4), None)