Created unit test for ClassInfo class.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
04be2b1ca2
commit
1abf8c6149
2 changed files with 30 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ PYSIDE_TEST(bug_826.py)
|
||||||
PYSIDE_TEST(bug_829.py)
|
PYSIDE_TEST(bug_829.py)
|
||||||
PYSIDE_TEST(bug_835.py)
|
PYSIDE_TEST(bug_835.py)
|
||||||
PYSIDE_TEST(blocking_signals_test.py)
|
PYSIDE_TEST(blocking_signals_test.py)
|
||||||
|
PYSIDE_TEST(classinfo_test.py)
|
||||||
PYSIDE_TEST(child_event_test.py)
|
PYSIDE_TEST(child_event_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
PYSIDE_TEST(deletelater_test.py)
|
PYSIDE_TEST(deletelater_test.py)
|
||||||
|
|
|
||||||
29
tests/QtCore/classinfo_test.py
Normal file
29
tests/QtCore/classinfo_test.py
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
from PySide.QtCore import QObject, ClassInfo
|
||||||
|
|
||||||
|
@ClassInfo(author='pyside',url='http://www.pyside.org')
|
||||||
|
class MyObject(QObject):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class TestClassInfo(unittest.TestCase):
|
||||||
|
def testMetaData(self):
|
||||||
|
o = MyObject()
|
||||||
|
mo = o.metaObject()
|
||||||
|
self.assertEqual(mo.classInfoCount(), 2)
|
||||||
|
|
||||||
|
ci = mo.classInfo(0) #author
|
||||||
|
self.assertEqual(ci.name(), 'author')
|
||||||
|
self.assertEqual(ci.value(), 'pyside')
|
||||||
|
|
||||||
|
ci = mo.classInfo(1) #url
|
||||||
|
self.assertEqual(ci.name(), 'url')
|
||||||
|
self.assertEqual(ci.value(), 'http://www.pyside.org')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if sys.version_info[0] < 2:
|
||||||
|
sys.exit(0)
|
||||||
|
elif (sys.version_info[0] == 2) and (sys.version_info[1] <= 5):
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue