def testNamedSelector(self): @objc.namedSelector(b'foo:bar:') def mymethod(self, a, b): pass self.assertIsInstance(mymethod, objc.selector) self.assertEqual(mymethod.signature, b"v@:@@") self.assertEqual(mymethod.selector, b"foo:bar:") self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:"), None) self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:"), 42) @objc.namedSelector(b'foo:bar:', signature=b"q@:qq") def mymethod(self, a, b): pass self.assertIsInstance(mymethod, objc.selector) self.assertEqual(mymethod.signature, b"q@:qq") self.assertEqual(mymethod.selector, b"foo:bar:") self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:", b"q@:qq"), None) self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:", b"q@:qq"), 42)
def testNamedSelector(self): @objc.namedSelector(b"foo:bar:") def mymethod(self, a, b): pass self.assertIsInstance(mymethod, objc.selector) self.assertEqual(mymethod.signature, b"v@:@@") self.assertEqual(mymethod.selector, b"foo:bar:") self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:"), None) self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:"), 42) @objc.namedSelector(b"foo:bar:", signature=b"q@:qq") def mymethod(self, a, b): pass self.assertIsInstance(mymethod, objc.selector) self.assertEqual(mymethod.signature, b"q@:qq") self.assertEqual(mymethod.selector, b"foo:bar:") self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:", b"q@:qq"), None) self.assertRaises(TypeError, objc.namedSelector(b"foo:bar:", b"q@:qq"), 42)