当前位置: 首页>>代码示例>>Python>>正文


Python OC_TestNumber.compareA_andB_方法代码示例

本文整理汇总了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)
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:14,代码来源:test_number_proxy.py

示例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)
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:14,代码来源:test_number_proxy.py

示例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)
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:23,代码来源:test_number_proxy.py


注:本文中的PyObjCTest.pythonnumber.OC_TestNumber.compareA_andB_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。