1import os 2import unittest 3from PySide2.QtCore import QFile 4import example_rc 5 6class TestRccSimple(unittest.TestCase): 7 8 def setUp(self): 9 self.testdir = os.path.dirname(__file__) 10 11 def testSimple(self): 12 handle = QFile(":words.txt") 13 handle.open(QFile.ReadOnly) 14 original = open(os.path.join(self.testdir, "words.txt"), "r") 15 self.assertEqual(handle.readLine(), original.readline()) 16 17 def testAlias(self): 18 handle = QFile(":jack") 19 handle.open(QFile.ReadOnly) 20 original = open(os.path.join(self.testdir, "shining.txt"), "r") 21 self.assertEqual(handle.readLine(), original.readline()) 22 23 def testHuge(self): 24 handle = QFile(":manychars.txt") 25 handle.open(QFile.ReadOnly) 26 original = open(os.path.join(self.testdir, "manychars.txt"), "r") 27 self.assertEqual(handle.readLine(), original.readline()) 28 29 30if __name__ == '__main__': 31 unittest.main() 32