summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-06-02 15:35:24 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-06-02 17:53:46 -0300
commit0b1eea71164c6980303a152438c55991c70c016d (patch)
treec6e94530edba2d5a7e83cec5aa74421d2d17644b
parent81272187412a2c6a3a13c95307c3f45d8f024562 (diff)
downloadpyside-0b1eea71164c6980303a152438c55991c70c016d.tar.gz
pyside-0b1eea71164c6980303a152438c55991c70c016d.tar.xz
pyside-0b1eea71164c6980303a152438c55991c70c016d.zip
Unit test for bug862 - "Problems when printing objects"
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_862.py40
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 27cf8b5..dbd1adf 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -61,6 +61,7 @@ PYSIDE_TEST(bug_834.py)
PYSIDE_TEST(bug_836.py)
PYSIDE_TEST(bug_844.py)
PYSIDE_TEST(bug_854.py)
+PYSIDE_TEST(bug_862.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(event_filter_test.py)
diff --git a/tests/QtGui/bug_862.py b/tests/QtGui/bug_862.py
new file mode 100644
index 0000000..b817913
--- /dev/null
+++ b/tests/QtGui/bug_862.py
@@ -0,0 +1,40 @@
+
+from PySide.QtCore import QObject
+from PySide.QtGui import *
+import PySide.QtCore
+import unittest
+
+class MyQObject(QObject):
+ def __init__(self):
+ QObject.__init__(self)
+
+class MyQWidget(QWidget):
+ def __init__(self):
+ QWidget.__init__(self)
+
+class MyQGraphicsObject(QGraphicsObject):
+ def __init__(self):
+ QGraphicsObject.__init__(self)
+
+class MyQGraphicsItem(QGraphicsItem):
+ def __init__(self):
+ QGraphicsItem.__init__(self)
+
+class TestRepr (unittest.TestCase):
+
+ def testIt(self):
+
+ app = QApplication([])
+
+ self.assertEqual("<__main__.MyQObject object at ", repr(MyQObject())[:30])
+ self.assertEqual("<__main__.MyQWidget object at ", repr(MyQWidget())[:30])
+ self.assertEqual("<__main__.MyQGraphicsObject(this = 0x", repr(MyQGraphicsObject())[:37])
+ self.assertEqual("<__main__.MyQGraphicsItem(this = 0x", repr(MyQGraphicsItem())[:35])
+
+ self.assertEqual("<PySide.QtCore.QObject object at ", repr(QObject())[:33])
+ self.assertEqual("<PySide.QtCore.QObject object at ", repr(PySide.QtCore.QObject())[:33])
+ self.assertEqual("<PySide.QtGui.QWidget object at ", repr(QWidget())[:32])
+ self.assertEqual("<PySide.QtGui.QGraphicsWidget(this = 0x", repr(QGraphicsWidget())[:39])
+
+if __name__ == "__main__":
+ unittest.main()