| 56 | self.assertEqual( IECore.frameListFromList( [ 5, 4, 3, 2, 1 ] ), f ) |
| 57 | |
| 58 | def testFrameRange( self ) : |
| 59 | |
| 60 | f = IECore.FrameList.parse( "1-5" ) |
| 61 | self.assertTrue( isinstance( f, IECore.FrameRange ) ) |
| 62 | self.assertEqual( f.asList(), [ 1, 2, 3, 4, 5 ] ) |
| 63 | # test step |
| 64 | f = IECore.FrameList.parse( "10-20x5" ) |
| 65 | self.assertTrue( isinstance( f, IECore.FrameRange ) ) |
| 66 | self.assertEqual( f.asList(), [ 10, 15, 20 ] ) |
| 67 | # start must be smaller or equal to end |
| 68 | self.assertRaises( Exception, IECore.FrameList.parse, "5-1" ) |
| 69 | # step must be positive |
| 70 | self.assertRaises( Exception, IECore.FrameList.parse, "1-5x0" ) |
| 71 | self.assertRaises( Exception, IECore.FrameList.parse, "1-5x-1" ) |
| 72 | self.assertRaises( Exception, IECore.FrameList.parse, "5-1x-1" ) |
| 73 | |
| 74 | |
| 75 | ## \todo: there should probably be a lot more tests in here... |