本文整理汇总了Python中PyObjCTest.testhelper.PyObjC_TestClass3.keyValue_forObject_key_方法的典型用法代码示例。如果您正苦于以下问题:Python PyObjC_TestClass3.keyValue_forObject_key_方法的具体用法?Python PyObjC_TestClass3.keyValue_forObject_key_怎么用?Python PyObjC_TestClass3.keyValue_forObject_key_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObjCTest.testhelper.PyObjC_TestClass3
的用法示例。
在下文中一共展示了PyObjC_TestClass3.keyValue_forObject_key_方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStoredValueForKey
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testStoredValueForKey(self):
o = KeyValueClass1.alloc().init()
o.addMultiple()
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"key1".decode('ascii')), 1)
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"key2".decode('ascii')), 2)
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"key3".decode('ascii')), 3)
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"key4".decode('ascii')), "4")
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"multiple".decode('ascii')), o.multiple)
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 2, o, b"nokey".decode('ascii'))
示例2: testStoredValueForKey
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testStoredValueForKey(self):
o = KeyValueClass1Explicit.alloc().init()
o.addMultiple()
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"key1"), 1)
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"key2"), 2)
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"key3"), 3)
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"key4"), "4")
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"multiple"), o._values['multiple'])
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 2, o, u"nokey")
示例3: testValueForKeyPath
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testValueForKeyPath(self):
o = KeyValueClass1Explicit.alloc().init()
o.addMultiple()
self.assertEquals(STUB.keyValue_forObject_key_(1, o, u"multiple"), o._values['multiple'])
self.assertEquals(STUB.keyValue_forObject_key_(1, o, u"multiple.level2"), o._values['multiple']._values['level2'])
self.assertEquals(STUB.keyValue_forObject_key_(1, o, u"multiple.level2.level3.keyA"),
o._values['multiple']._values['level2']._values['level3']._values['keyA'])
self.assertEquals(STUB.keyValue_forObject_key_(1, o, u"multiple.level2.level3.keyB"),
o._values['multiple']._values['level2']._values['level3']._values['keyB'])
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 1, o, u"multiple.level2.nokey")
示例4: testValueForKey
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testValueForKey(self):
o = KeyValueClass1Explicit.alloc().init()
o.addMultiple()
self.assertEqual(STUB.keyValue_forObject_key_(0, o, b"key1".decode('ascii')), 1)
self.assertEqual(STUB.keyValue_forObject_key_(0, o, b"key2".decode('ascii')), 2)
self.assertEqual(STUB.keyValue_forObject_key_(0, o, b"key3".decode('ascii')), 3)
self.assertEqual(STUB.keyValue_forObject_key_(0, o, b"key4".decode('ascii')), "4")
self.assertEqual(STUB.keyValue_forObject_key_(0, o, b"multiple".decode('ascii')), o._values['multiple'])
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 0, o, b"nokey".decode('ascii'))
示例5: testValueForKey
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testValueForKey(self):
o = KeyValueClass1.alloc().init()
o.addMultiple()
self.assertEquals(STUB.keyValue_forObject_key_(0, o, u"key1"), 1)
self.assertEquals(STUB.keyValue_forObject_key_(0, o, u"key2"), 2)
self.assertEquals(STUB.keyValue_forObject_key_(0, o, u"key3"), 3)
self.assertEquals(STUB.keyValue_forObject_key_(0, o, u"key4"), "4")
self.assertEquals(STUB.keyValue_forObject_key_(0, o, u"multiple"), o.multiple)
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 0, o, u"nokey")
self.assertRaises(ValueError, STUB.keyValue_forObject_key_, 0, o,
u"keyRaisingValueError")
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 0, o,
u"keyRaisingNSUnknownKeyException")
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 0, o,
u"keyReturningSameSelector")
obj = STUB.keyValue_forObject_key_( 0, o, u"keyReturningOtherSelector")
self.failUnless( isinstance(obj, objc.selector) )
self.assertEquals(obj.selector, "getKey1")
self.failUnless( obj.self is o )
示例6: testValuesForKeys
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testValuesForKeys(self):
o = KeyValueClass1Explicit.alloc().init()
self.assertEquals(STUB.keyValue_forObject_key_(3, o, [u"key1", u"key2", u"key3", u"key4"]), { u"key1":1, u"key2":2, u"key3": 3, u"key4": u"4"} )
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 3, o, [u"key1", u"key3", u"nosuchkey"])
示例7: testStoredValueForKey2
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testStoredValueForKey2(self):
o = KeyValueClass4.alloc().init()
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"foo"), u"foobar")
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"bar"), u"foobarfoobar")
self.assertEquals(STUB.keyValue_forObject_key_(2, o, u"roprop"), u"read-only")
示例8: testValuesForKeys
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testValuesForKeys(self):
o = KeyValueClass1Explicit.alloc().init()
self.assertEqual(STUB.keyValue_forObject_key_(3, o, [b"key1".decode('ascii'), b"key2".decode('ascii'), b"key3".decode('ascii'), b"key4".decode('ascii')]), { b"key1".decode('ascii'):1, b"key2".decode('ascii'):2, b"key3".decode('ascii'): 3, b"key4".decode('ascii'): b"4".decode('ascii')} )
self.assertRaises(KeyError, STUB.keyValue_forObject_key_, 3, o, [b"key1".decode('ascii'), b"key3".decode('ascii'), b"nosuchkey".decode('ascii')])
示例9: testStoredValueForKey2
# 需要导入模块: from PyObjCTest.testhelper import PyObjC_TestClass3 [as 别名]
# 或者: from PyObjCTest.testhelper.PyObjC_TestClass3 import keyValue_forObject_key_ [as 别名]
def testStoredValueForKey2(self):
o = KeyValueClass4.alloc().init()
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"foo".decode('ascii')), b"foobar".decode('ascii'))
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"bar".decode('ascii')), b"foobarfoobar".decode('ascii'))
self.assertEqual(STUB.keyValue_forObject_key_(2, o, b"roprop".decode('ascii')), b"read-only".decode('ascii'))