本文整理汇总了Python中PyObjCTest.pythonnumber.OC_TestNumber.numberClass_方法的典型用法代码示例。如果您正苦于以下问题:Python OC_TestNumber.numberClass_方法的具体用法?Python OC_TestNumber.numberClass_怎么用?Python OC_TestNumber.numberClass_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObjCTest.pythonnumber.OC_TestNumber
的用法示例。
在下文中一共展示了OC_TestNumber.numberClass_方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testClasses
# 需要导入模块: from PyObjCTest.pythonnumber import OC_TestNumber [as 别名]
# 或者: from PyObjCTest.pythonnumber.OC_TestNumber import numberClass_ [as 别名]
def testClasses(self):
# Ensure that python numbers are proxied using the right proxy type
for v in (0, 1, 2**32+1, 2**64+1, 42.5):
self.assert_(OC_TestNumber.numberClass_(v) is OC_PythonNumber)
# The booleans True and False must be proxied as the corresponding
# NSNumber constants, otherwise lowlevel Cocoa/CoreFoundation code
# get's upset.
boolClass = objc.lookUpClass('NSCFBoolean')
for v in (True, False):
self.assert_(OC_TestNumber.numberClass_(v) is boolClass)
self.assert_(objc.repythonify(v) is v)
示例2: testClass
# 需要导入模块: from PyObjCTest.pythonnumber import OC_TestNumber [as 别名]
# 或者: from PyObjCTest.pythonnumber.OC_TestNumber import numberClass_ [as 别名]
def testClass(self):
for m in ('numberWithInt_', 'numberWithFloat_', 'numberWithDouble_', 'numberWithShort_'):
v = getattr(NSNumber, m)(0)
self.assertIsInstance(v, NSNumber)
self.assertIsNotInstance(v, OC_PythonNumber)
self.assertIs(OC_TestNumber.numberClass_(v), NSCFNumber)