aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtcore
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2009-11-06 20:00:19 -0300
committerLauro Neto <lauro.neto@openbossa.org>2009-11-10 20:39:30 -0300
commitbc20292caabce8a1def8d1d8037386351500ae21 (patch)
tree3385b25d634b783fde9be04d1f7ce728f0ecb0ec /tests/qtcore
parent92f10f962960df539a388f6307ea4082d41bac3e (diff)
Add test to QDataStream.read/write Int8
Diffstat (limited to 'tests/qtcore')
-rw-r--r--tests/qtcore/qdatastream_test.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/qtcore/qdatastream_test.py b/tests/qtcore/qdatastream_test.py
index b7f7eafbf..d0173fc95 100644
--- a/tests/qtcore/qdatastream_test.py
+++ b/tests/qtcore/qdatastream_test.py
@@ -21,12 +21,37 @@ class QDataStreamWrite(unittest.TestCase):
self.write = QDataStream(self.ba, QIODevice.WriteOnly)
def testWriteUInt8(self):
- '''QDataStream.writeUInt8'''
+ '''QDataStream.writeUInt8 (accepting str of size 1)'''
x = 0xFF
self.write.writeUInt8(chr(x))
y = ord(self.read.readUInt8())
self.assertEqual(x, y)
+ self.assertRaises(TypeError, self.write.writeUInt8, 'aaaaa')
+
+ def testWriteInt8(self):
+ '''QDataStream.writeInt8 (accepting str of size 1)'''
+ x = 0xFF
+ self.write.writeInt8(chr(x))
+ y = ord(self.read.readInt8())
+ self.assertEqual(x, y)
+
+ self.assertRaises(TypeError, self.write.writeInt8, 'aaaaa')
+
+ def testWriteUInt8Int(self):
+ '''QDataStream.writeUInt8 (accepting integer)'''
+ x = 0xFF
+ self.write.writeUInt8(x)
+ y = self.read.readUInt8()
+ self.assertEqual(x, y)
+
+ def testWriteInt8Int(self):
+ '''QDataStream.writeInt8 (accepting integer)'''
+ x = 0xFF
+ self.write.writeInt8(x)
+ y = self.read.readInt8()
+ self.assertEqual(x, y)
+
def testWriteUInt16(self):
'''QDataStream.writeUInt16'''
x = 0x4423