1from PyObjCTools.TestSupport import * 2 3from Foundation import * 4 5class TestNSIndexPath (TestCase): 6 def testMethods(self): 7 self.assertArgIsIn(NSIndexPath.indexPathWithIndexes_length_, 0) 8 self.assertArgSizeInArg(NSIndexPath.indexPathWithIndexes_length_, 0, 1) 9 10 self.assertArgIsIn(NSIndexPath.initWithIndexes_length_, 0) 11 self.assertArgSizeInArg(NSIndexPath.initWithIndexes_length_, 0, 1) 12 13 self.assertArgIsOut(NSIndexPath.getIndexes_, 0) 14 self.assertArgIsVariableSize(NSIndexPath.getIndexes_, 0) 15 16 def testConvenience(self): 17 path = NSIndexPath.indexPathWithIndexes_length_([0, 1, 4], 3) 18 19 self.assertEqual(path[0], 0) 20 self.assertEqual(path[1], 1) 21 self.assertEqual(path[2], 4) 22 23 self.assertEqual(len(path), 3) 24 25 p2 = path + 9 26 self.assertEqual(len(p2), len(path) + 1) 27 self.assertEqual(p2[3], 9) 28 29 30if __name__ == "__main__": 31 main() 32