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)
def testReprInject(self): """Test that injecting __repr__ via typesystem overrides the operator<<(QDebug, ...)""" t = PySideCPP.TestObject2WithNamespace(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.assertEqual(str(t), "TestObject2WithNamespace(injected_repr)")
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))