Exemplo n.º 1
0
        def testWithCount(self):
            o = Py_MetaDataTest_OutputOptional.new()

            v = o.fillArray_count_(3)
            self.assertEquals(list(v),  [10, 11, 12])

            v = o.fillArray_count_(None, 3)
            self.assertEquals(list(v),  [10, 11, 12])

            v = o.fillArray_count_(5)
            self.assertEquals(list(v),  [10, 11, 12, 13, 14])

            v = o.fillArray_count_(0)
            self.assertEquals(list(v),  [])

            #self.assertRaises(ValueError, o.fillArray_count_, objc.NULL, 0)
            
            n, v = o.nullfillArray_count_(3)
            self.assertEquals(n, 2)
            self.assertEquals(list(v),  [30,31,32])
            n, v = o.nullfillArray_count_(None, 3)
            self.assertEquals(n, 2)
            self.assertEquals(list(v),  [30,31,32])

            n, v = o.nullfillArray_count_(objc.NULL, 3)
Exemplo n.º 2
0
        def testWithCount(self):
            o = Py_MetaDataTest_OutputOptional.new()

            v = o.fillArray_count_(3)
            self.assertEquals(list(v), [10, 11, 12])

            v = o.fillArray_count_(None, 3)
            self.assertEquals(list(v), [10, 11, 12])

            v = o.fillArray_count_(5)
            self.assertEquals(list(v), [10, 11, 12, 13, 14])

            v = o.fillArray_count_(0)
            self.assertEquals(list(v), [])

            #self.assertRaises(ValueError, o.fillArray_count_, objc.NULL, 0)

            n, v = o.nullfillArray_count_(3)
            self.assertEquals(n, 2)
            self.assertEquals(list(v), [30, 31, 32])
            n, v = o.nullfillArray_count_(None, 3)
            self.assertEquals(n, 2)
            self.assertEquals(list(v), [30, 31, 32])

            n, v = o.nullfillArray_count_(objc.NULL, 3)
Exemplo n.º 3
0
        def testWithCountInResult(self):
            o = Py_MetaDataTest_OutputOptional.new()

            c, v = o.fillArray_uptoCount_(20)
            self.assertEquals(c, 10)
            self.assertEquals(list(v), [i + 10 for i in range(10)])

            c, v = o.maybeFillArray_()
            self.assertEquals(c, 2)
            self.assertEquals(list(v), [0, 1])
Exemplo n.º 4
0
        def testWithCountInResult(self):
            o = Py_MetaDataTest_OutputOptional.new()

            c, v = o.fillArray_uptoCount_(20)
            self.assertEquals(c, 10)
            self.assertEquals(list(v),  [i+10 for i in range(10)])

            c, v = o.maybeFillArray_()
            self.assertEquals(c, 2)
            self.assertEquals(list(v),  [0, 1])
Exemplo n.º 5
0
        def testFixedSize(self):
            o = Py_MetaDataTest_OutputOptional.new()

            v = o.fill4Tuple_()
            self.assertEquals(list(v), list(range(9, 13)))

            v = o.fill4Tuple_(None)
            self.assertEquals(list(v), list(range(9, 13)))

            self.assertRaises(ValueError, OC_MetaDataTest.fill4Tuple_on_, objc.NULL, o)

            n, v = o.nullfill4Tuple_()
            self.assertEquals(n, 1)
            self.assertEquals(list(v), list(range(1, 5)))

            n, v = o.nullfill4Tuple_(None)
            self.assertEquals(n, 1)
            self.assertEquals(list(v), list(range(1, 5)))

            n, v = o.nullfill4Tuple_(objc.NULL)
Exemplo n.º 6
0
        def testFixedSize(self):
            o = Py_MetaDataTest_OutputOptional.new()

            v = o.fill4Tuple_()
            self.assertEquals(list(v), list(range(9, 13)))

            v = o.fill4Tuple_(None)
            self.assertEquals(list(v), list(range(9, 13)))

            self.assertRaises(ValueError, OC_MetaDataTest.fill4Tuple_on_,
                              objc.NULL, o)

            n, v = o.nullfill4Tuple_()
            self.assertEquals(n, 1)
            self.assertEquals(list(v), list(range(1, 5)))

            n, v = o.nullfill4Tuple_(None)
            self.assertEquals(n, 1)
            self.assertEquals(list(v), list(range(1, 5)))

            n, v = o.nullfill4Tuple_(objc.NULL)
Exemplo n.º 7
0
 def testNullTerminated(self):
     o = Py_MetaDataTest_OutputOptional.new()
Exemplo n.º 8
0
 def testNullTerminated(self):
     o = Py_MetaDataTest_OutputOptional.new()