Fixing several tests

Using isinstance instead of comparing classes names
Removing unnecessary tuple check, treated by the return value unpacking
Adding missing inject code tests
Adding qfile.getchar test

Fixing QLocale.to* methods
fixing __setitem__ in qbytearray
This commit is contained in:
Lauro Neto 2010-02-01 18:00:43 -03:00 • committed by Hugo Lima
commit 74351882b5
13 changed files with 291 additions and 45 deletions

View file

@ -0,0 +1,31 @@
import unittest
import os
import tempfile
from PySide.QtCore import QFile, QIODevice
class GetCharTest(unittest.TestCase):
'''Test case for QIODevice.getChar in QFile'''
def setUp(self):
'''Acquire resources'''
handle, self.filename = tempfile.mkstemp()
os.write(handle, 'a')
os.close(handle)
def tearDown(self):
'''release resources'''
os.remove(self.filename)
def testBasic(self):
'''QFile.getChar'''
obj = QFile(self.filename)
obj.open(QIODevice.ReadOnly)
self.assertEqual(obj.getChar(), (True, 'a'))
self.assert_(not obj.getChar()[0])
obj.close()
if __name__ == '__main__':
unittest.main()