Initia QtCore port to python3.

This commit is contained in:
Renato Filho 2011-10-03 18:49:42 -03:00 • committed by Hugo Parente Lima
commit 1e29ab6592
52 changed files with 380 additions and 286 deletions

View file

@ -3,6 +3,7 @@ import unittest
import os
import tempfile
import py3kcompat as py3k
from PySide.QtCore import QFile, QIODevice
@ -12,7 +13,7 @@ class GetCharTest(unittest.TestCase):
def setUp(self):
'''Acquire resources'''
handle, self.filename = tempfile.mkstemp()
os.write(handle, 'a')
os.write(handle, py3k.b('a'))
os.close(handle)
def tearDown(self):
@ -24,7 +25,7 @@ class GetCharTest(unittest.TestCase):
obj = QFile(self.filename)
obj.open(QIODevice.ReadOnly)
self.assertEqual(obj.getChar(), (True, 'a'))
self.assert_(not obj.getChar()[0])
self.assertFalse(obj.getChar()[0])
obj.close()
def testBug721(self):
@ -32,7 +33,7 @@ class GetCharTest(unittest.TestCase):
obj.open(QIODevice.ReadOnly)
memory = obj.map(0, 1)
self.assertEqual(len(memory), 1)
self.assertEqual(memory[0], 'a')
self.assertEqual(memory[0], py3k.b('a'))
obj.unmap(memory)
# now memory points to wild bytes... :-)
# uncommenting this must cause a segfault.