def testTypedfWithouNamespace(self):
        self._called = None
        o = PySideCPP.TestObjectWithNamespace(None)
        o.emitSignalWithTypedef.connect(self.callback)
        o.emitSignalWithTypedef.emit(10)
        self.assertEqual(10, self._called)

        self._called = None
        o = PySideCPP.TestObjectWithNamespace(None)
        o.emitSignalWithTypedef.connect(self.callback)
        o.callSignalWithTypedef(10)
        self.assertEqual(10, self._called)
    def testWithNamespace(self):
        self._called = None
        o = PySideCPP.TestObjectWithNamespace(None)
        o.emitSignalWithNamespace.connect(self.callback)
        o.emitSignalWithNamespace.emit(o)
        self.assertTrue(o == self._called)

        self._called = None
        o = PySideCPP.TestObjectWithNamespace(None)
        o.emitSignalWithNamespace.connect(self.callback)
        o.callSignalWithNamespace(o)
        self.assertTrue(o == self._called)
Пример #3
0
    def testReprWithNamespace(self):
        """Test that classes inside a namespace that have a operator<<(QDebug,...) defined use that
        for __repr__"""
        t = PySideCPP.TestObjectWithNamespace(None)

        # We don't define __str__, so str(q) should call __repr__
        self.assertEqual(t.__repr__(), str(t))

        # __repr__ should use the operator<<(QDebug,...) implementation
        self.assertIn('TestObjectWithNamespace("TestObjectWithNamespace")',
                      str(t))