本文整理汇总了Python中PyObjCTest.pythonnumber.OC_TestNumber.compareA_andB_方法的典型用法代码示例。如果您正苦于以下问题:Python OC_TestNumber.compareA_andB_方法的具体用法?Python OC_TestNumber.compareA_andB_怎么用?Python OC_TestNumber.compareA_andB_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObjCTest.pythonnumber.OC_TestNumber
的用法示例。
在下文中一共展示了OC_TestNumber.compareA_andB_方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCompare
# 需要导入模块: from PyObjCTest.pythonnumber import OC_TestNumber [as 别名]
# 或者: from PyObjCTest.pythonnumber.OC_TestNumber import compareA_andB_ [as 别名]
def testCompare(self):
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithLong_(1)), NSOrderedAscending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithUnsignedLongLong_(2**40)), NSOrderedAscending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithDouble_(42.0)), NSOrderedAscending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithLong_(-1)), NSOrderedDescending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithLongLong_(-2**60)), NSOrderedDescending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithDouble_(-42.0)), NSOrderedDescending)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithLong_(0)), NSOrderedSame)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithDouble_(0.0)), NSOrderedSame)
self.assertEqual(OC_TestNumber.compareA_andB_(NSNumber.numberWithLong_(0), NSNumber.numberWithLongLong_(0)), NSOrderedSame)
示例2: testCompare
# 需要导入模块: from PyObjCTest.pythonnumber import OC_TestNumber [as 别名]
# 或者: from PyObjCTest.pythonnumber.OC_TestNumber import compareA_andB_ [as 别名]
def testCompare(self):
self.assertEquals(OC_TestNumber.compareA_andB_(0, 1), NSOrderedAscending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, 2**64), NSOrderedAscending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, 42.0), NSOrderedAscending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, -1), NSOrderedDescending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, -2**64), NSOrderedDescending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, -42.0), NSOrderedDescending)
self.assertEquals(OC_TestNumber.compareA_andB_(0, 0), NSOrderedSame)
self.assertEquals(OC_TestNumber.compareA_andB_(0, 0.0), NSOrderedSame)
self.assertEquals(OC_TestNumber.compareA_andB_(0, long(0)), NSOrderedSame)
示例3: testMixedCompare
# 需要导入模块: from PyObjCTest.pythonnumber import OC_TestNumber [as 别名]
# 或者: from PyObjCTest.pythonnumber.OC_TestNumber import compareA_andB_ [as 别名]
def testMixedCompare(self):
# compare for:
# - python number to nsnumber
# - nsnumber to python number
# For: (bool, int, long, float) vs (char, short, ...)
methods = [
'numberWithInt_',
'numberWithChar_',
'numberWithLong_',
'numberWithDouble_',
]
self.assertEqual(OC_TestNumber.compareA_andB_(42, 42), NSOrderedSame)
for m in methods:
self.assertEqual(OC_TestNumber.compareA_andB_(getattr(NSNumber, m)(42), 42), NSOrderedSame)
self.assertEqual(OC_TestNumber.compareA_andB_(42, getattr(NSNumber, m)(42)), NSOrderedSame)
self.assertEqual(OC_TestNumber.compareA_andB_(42, 99), NSOrderedAscending)
for m in methods:
self.assertEqual(OC_TestNumber.compareA_andB_(getattr(NSNumber, m)(42), 99), NSOrderedAscending)
self.assertEqual(OC_TestNumber.compareA_andB_(42, getattr(NSNumber, m)(99)), NSOrderedAscending)