コード例 #1
0
ファイル: test_set_proxy.py プロジェクト: danchr/pyobjc-git
    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]))
コード例 #2
0
    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]))