diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-01-21 13:49:30 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-01-21 13:50:50 -0300 |
commit | a50ecea26dc7035f32ca90a4118fcb8f0c836f6b (patch) | |
tree | 333aaec7d2c1fce76f042a56113de335c7688752 /tests | |
parent | ca75446b9b1b2160175db520691b56c0e16bfd12 (diff) |
Updates duck punching test to use 'types' module instead of 'new'.
The 'new' module was deprecated on behalf of 'types' module.
Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtcore/duck_punching_test.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/qtcore/duck_punching_test.py b/tests/qtcore/duck_punching_test.py index ddcf91d7b..9ddb2999d 100644 --- a/tests/qtcore/duck_punching_test.py +++ b/tests/qtcore/duck_punching_test.py @@ -1,10 +1,10 @@ #!/usr/bin/python -'''Test case for duck puching new implementations of C++ virtual methods into object instances.''' +'''Test case for duck punching new implementations of C++ virtual methods into object instances.''' import unittest -import new -from PySide.QtCore import QObject +import types +from PySide.QtCore import QObject, QEvent from helper import UsesQCoreApplication class Duck(QObject): @@ -14,7 +14,7 @@ class Duck(QObject): QObject.childEvent(self, event) class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication): - '''Test case for duck puching new implementations of C++ virtual methods into object instances.''' + '''Test case for duck punching new implementations of C++ virtual methods into object instances.''' def setUp(self): #Acquire resources @@ -33,7 +33,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication): def childEvent(obj, event): self.duck_childEvent_called = True QObject.childEvent(obj, event) - parent.event = new.instancemethod(childEvent, parent, QObject) + parent.event = types.MethodType(childEvent, parent, QObject) child = QObject() child.setParent(parent) self.assert_(self.duck_childEvent_called) @@ -46,7 +46,7 @@ class TestDuckPunchingOnQObjectInstance(UsesQCoreApplication): self.duck_childEvent_called = True child = QObject() child.setParent(parent) - parent.event = new.instancemethod(childEvent, parent, QObject) + parent.event = types.MethodType(childEvent, parent, QObject) child = QObject() child.setParent(parent) self.assert_(self.duck_childEvent_called) |