<s> import unittest <EOL> import IECore <EOL> import Gaffer <EOL> import GafferTest <EOL> class SequencePathTest ( GafferTest . TestCase ) : <EOL> def __dictPath ( self ) : <EOL> dict = { } <EOL> dict [ "<STR_LIT>" ] = { } <EOL> for f in IECore . FileSequence ( "<STR_LIT>" ) . fileNames ( ) : <EOL> dict [ "<STR_LIT>" ] [ f ] = <NUM_LIT:1> <EOL> for f in IECore . FileSequence ( "<STR_LIT>" ) . fileNames ( ) : <EOL> dict [ "<STR_LIT>" ] [ f ] = <NUM_LIT:1> <EOL> return Gaffer . DictPath ( dict , "<STR_LIT:/>" ) <EOL> def test ( self ) : <EOL> path = Gaffer . SequencePath ( self . __dictPath ( ) ) <EOL> self . failUnless ( path . isValid ( ) ) <EOL> self . failUnless ( not path . isLeaf ( ) ) <EOL> path . append ( "<STR_LIT>" ) <EOL> self . failUnless ( path . isValid ( ) ) <EOL> self . failUnless ( not path . isLeaf ( ) ) <EOL> path [ <NUM_LIT:0> ] = "<STR_LIT>" <EOL> self . failIf ( path . isValid ( ) ) <EOL> self . failIf ( path . isLeaf ( ) ) <EOL> path [ : ] = [ "<STR_LIT>" ] <EOL> children = path . children ( ) <EOL> for child in children : <EOL> self . failUnless ( isinstance ( child , Gaffer . SequencePath ) ) <EOL> self . assertEqual ( len ( children ) , <NUM_LIT:2> ) <EOL> childrenStrings = [ str ( c ) for c in children ] <EOL> self . failUnless ( "<STR_LIT>" in childrenStrings ) <EOL> self . failUnless ( "<STR_LIT>" in childrenStrings ) <EOL> def testNonLeafChildren ( self ) : <EOL> path = Gaffer . SequencePath ( self . __dictPath ( ) ) <EOL> children = path . children ( ) <EOL> for child in children : <EOL> self . failUnless ( isinstance ( child , Gaffer . SequencePath ) ) <EOL> self . assertEqual ( len ( children ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( str ( children [ <NUM_LIT:0> ] ) , "<STR_LIT>" ) <EOL> def testCopy ( self ) : <EOL> path = Gaffer . SequencePath ( self . __dictPath ( ) ) <EOL> path . append ( "<STR_LIT>" ) <EOL> path2 = path . copy ( ) <EOL> self . failUnless ( isinstance ( path2 , Gaffer . SequencePath ) ) <EOL> self . assertEqual ( path [ : ] , path2 [ : ] ) <EOL> self . failUnless ( path . getFilter ( ) is path2 . getFilter ( ) ) <EOL> c = [ str ( p ) for p in path . children ( ) ] <EOL> c2 = [ str ( p ) for p in path2 . children ( ) ] <EOL> self . assertEqual ( c , c2 ) <EOL> def testInfo ( self ) : <EOL> dictPath = self . __dictPath ( ) <EOL> path = Gaffer . SequencePath ( dictPath ) <EOL> self . assertEqual ( dictPath . info ( ) , path . info ( ) ) <EOL> def testInfoOfInvalidPath ( self ) : <EOL> fp = Gaffer . FileSystemPath ( "<STR_LIT>" ) <EOL> self . assertEqual ( fp . isValid ( ) , False ) <EOL> self . assertEqual ( fp . info ( ) , None ) <EOL> sp = Gaffer . SequencePath ( fp ) <EOL> self . assertEqual ( sp . isValid ( ) , False ) <EOL> self . assertEqual ( sp . info ( ) , None ) <EOL> def testFilter ( self ) : <EOL> dictPath = self . __dictPath ( ) <EOL> path = Gaffer . SequencePath ( dictPath ) <EOL> def testIsEmpty ( self ) : <EOL> dictPath = self . __dictPath ( ) <EOL> path = Gaffer . SequencePath ( dictPath ) <EOL> path . setFromString ( "<STR_LIT>" ) <EOL> self . assertTrue ( path . isEmpty ( ) ) <EOL> path2 = path . copy ( ) <EOL> self . assertTrue ( path2 . isEmpty ( ) ) <EOL> def testProperties ( self ) : <EOL> dictPath = self . __dictPath ( ) <EOL> path = Gaffer . SequencePath ( dictPath ) <EOL> self . assertEqual ( dictPath . propertyNames ( ) , path . propertyNames ( ) ) <EOL> self . assertEqual ( dictPath . property ( "<STR_LIT>" ) , path . property ( "<STR_LIT>" ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
