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


Python pythonset.OC_TestSet类代码示例

本文整理汇总了Python中PyObjCTest.pythonset.OC_TestSet的典型用法代码示例。如果您正苦于以下问题:Python OC_TestSet类的具体用法?Python OC_TestSet怎么用?Python OC_TestSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OC_TestSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testIsSubSet

    def testIsSubSet(self):
        s1 = self.setClass(range(10))
        s2 = self.setClass(range(5))

        self.assertTrue(OC_TestSet.set_isSubsetOfSet_(s2, s1))
        self.assertTrue(OC_TestSet.set_isSubsetOfSet_(s2, s2))
        self.assertFalse(OC_TestSet.set_isSubsetOfSet_(s1, s2))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:7,代码来源:test_set_proxy.py

示例2: testAddObjectsFromArray

    def testAddObjectsFromArray(self):
        s = self.setClass([1,2,3])

        OC_TestSet.set_addObjectsFromArray_(s, [1,2])
        self.assertEqual(s, self.setClass([1,2,3]))

        OC_TestSet.set_addObjectsFromArray_(s, [9,5,4])
        self.assertEqual(s, self.setClass([1,2,3,9,5,4]))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:8,代码来源:test_set_proxy.py

示例3: testRemoveObject

    def testRemoveObject(self):
        s = self.setClass([1,2,3])

        OC_TestSet.set_removeObject_(s, 1)
        self.assertEqual(s, self.setClass([2,3]))

        OC_TestSet.set_removeObject_(s, 9)
        self.assertEqual(s, self.setClass([2,3]))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:8,代码来源:test_set_proxy.py

示例4: testAllObject

    def testAllObject(self):
        s = self.setClass()
        self.assertEqual(OC_TestSet.allObjectsOfSet_(s), [])

        s = self.setClass([1,2,3])
        o = OC_TestSet.allObjectsOfSet_(s)
        o.sort()
        self.assertEqual(o, [1,2,3])
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:8,代码来源:test_set_proxy.py

示例5: testIntersects

    def testIntersects(self):
        s1 = self.setClass([1,2,3,4])
        s2 = self.setClass([3,4,5,6])
        s3 = self.setClass([5,6,7,8])

        self.assertTrue(OC_TestSet.set_intersectsSet_(s1, s2))
        self.assertTrue(OC_TestSet.set_intersectsSet_(s2, s3))
        self.assertFalse(OC_TestSet.set_intersectsSet_(s1, s3))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:8,代码来源:test_set_proxy.py

示例6: testAddObject

    def testAddObject(self):
        s = self.setClass([1,2,3])

        OC_TestSet.set_addObject_(s, 1)
        self.assertEqual(s, self.setClass([1,2,3]))

        OC_TestSet.set_addObject_(s, 9)
        self.assertEqual(s, self.setClass([1,2,3,9]))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:8,代码来源:test_set_proxy.py

示例7: testCopy

    def testCopy(self):
        s = self.seqClass()
        o = OC_TestSet.set_copyWithZone_(s, None)
        self.assertEquals(s, o)

        s = self.seqClass(range(20))
        o = OC_TestSet.set_copyWithZone_(s, None)
        self.assertEquals(s, o)
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:8,代码来源:test_list_proxy.py

示例8: testCopy

    def testCopy(self):
        s = self.mapClass()
        o = OC_TestSet.set_copyWithZone_(s, None)
        self.assertEquals(s, o)
        self.assert_(s is not o)

        s = self.mapClass({1:2, 'a':'c'})
        o = OC_TestSet.set_copyWithZone_(s, None)
        self.assertEquals(s, o)
        self.assert_(s is not o)
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:10,代码来源:test_dict_proxy.py

示例9: testMakeObjectsPerform

    def testMakeObjectsPerform(self):
        o1 = OC_TestElem(1)
        o2 = OC_TestElem(2)
        o3 = OC_TestElem(3)
        s = self.setClass([o1, o2, o3])

        o = OC_TestSet.set_member_(s, OC_TestElem(4))
        self.assertIsNone(o)

        o = OC_TestSet.set_member_(s, OC_TestElem(2))
        self.assertIs(o, o2)
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:11,代码来源:test_set_proxy.py

示例10: testMutableCopy

    def testMutableCopy(self):

        s = self.mapClass({1:2, 'a':'c'})
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEqual(dict(s), o)
        self.assertIsNot(s, o)
        self.assertIsInstance(o, dict)

        s = self.mapClass()
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEqual(dict(s), o)
        self.assertIsNot(s, o)
        self.assertIsInstance(o, dict)
开发者ID:BMXE,项目名称:music-player,代码行数:13,代码来源:test_dict_proxy.py

示例11: testMutableCopy

    def testMutableCopy(self):

        s = self.setClass(range(20))
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEqual(s, o)
        self.assertIsNot(s, o)
        self.assertIsInstance(o, set)

        s = self.setClass()
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEqual(s, o)
        self.assertIsNot(s, o)
        self.assertIsInstance(o, set)
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:13,代码来源:test_set_proxy.py

示例12: testMutableCopy

    def testMutableCopy(self):

        s = self.seqClass(range(20))
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEquals(list(s), o)
        self.assert_(s is not o)
        self.assert_(isinstance(o, list))

        s = self.seqClass()
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEquals(list(s), o)
        self.assert_(s is not o)
        self.assert_(isinstance(o, list))
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:13,代码来源:test_list_proxy.py

示例13: testMutableCopy

    def testMutableCopy(self):

        s = self.mapClass({1:2, 'a':'c'})
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEquals(dict(s), o)
        self.assert_(s is not o)
        self.assert_(isinstance(o, dict))

        s = self.mapClass()
        o = OC_TestSet.set_mutableCopyWithZone_(s, None)
        self.assertEquals(dict(s), o)
        self.assert_(s is not o)
        self.assert_(isinstance(o, dict))
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:13,代码来源:test_dict_proxy.py

示例14: testFilteredSetUsingPredicate

        def testFilteredSetUsingPredicate(self):
            s = self.setClass(range(10))
            p = OC_SetPredicate.alloc().initWithFunction_(lambda x: x % 2 == 0)

            o = OC_TestSet.set_filteredSetUsingPredicate_(s, p)
            self.assertEqual(o, self.setClass([0, 2, 4, 6, 8]))
            self.assertEqual(len(s), 10)
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:7,代码来源:test_set_proxy.py

示例15: testObjectEnumerator

    def testObjectEnumerator(self):
        s = self.setClass(range(10))

        enum = OC_TestSet.objectEnumeratorOfSet_(s)
        l = []
        v = enum.nextObject()
        while v is not None:
            l.append(v)
            v = enum.nextObject()
        self.assertEqual(l, list(range(10)))

        s = self.setClass([1, 2, None, 3])
        enum = OC_TestSet.objectEnumeratorOfSet_(s)
        l = []
        v = enum.nextObject()
        while v is not None:
            l.append(v)
            v = enum.nextObject()


        self.assertEqual(dict.fromkeys(l), dict.fromkeys([1,2,NSNull.null(),3]))
开发者ID:GreatFruitOmsk,项目名称:pyobjc-core,代码行数:21,代码来源:test_set_proxy.py


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