MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testCopyAndRemovePath

Method testCopyAndRemovePath

test/IECore/PathMatcherTest.py:756–795  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

754 self.assertEqual( p2.paths(), [ "/" ] )
755
756 def testCopyAndRemovePath( self ) :
757
758 initialPaths = [
759 "/a/b/c/d/e",
760 "/a/b",
761 "/e/f",
762 "/e/f/g",
763 "/g"
764 ]
765
766 pathsToRemove = [
767 "/a/b",
768 "/e/f/g",
769 "/g",
770 ]
771
772 m1 = IECore.PathMatcher( initialPaths )
773 m2 = IECore.PathMatcher( m1 )
774
775 self.assertEqual( set( m1.paths() ), set( initialPaths ) )
776 self.assertEqual( set( m2.paths() ), set( initialPaths ) )
777
778 for path in pathsToRemove :
779 m1.removePath( path )
780
781 self.assertEqual( set( m1.paths() ), set( initialPaths ) - set( pathsToRemove ) )
782 self.assertEqual( set( m2.paths() ), set( initialPaths ) )
783
784 # repeat, but add as PathMatcher rather than individual paths
785
786 m1 = IECore.PathMatcher( initialPaths )
787 m2 = IECore.PathMatcher( m1 )
788
789 self.assertEqual( set( m1.paths() ), set( initialPaths ) )
790 self.assertEqual( set( m2.paths() ), set( initialPaths ) )
791
792 m1.removePaths( IECore.PathMatcher( pathsToRemove ) )
793
794 self.assertEqual( set( m1.paths() ), set( initialPaths ) - set( pathsToRemove ) )
795 self.assertEqual( set( m2.paths() ), set( initialPaths ) )
796
797 def testCopyAndPrunePath( self ) :
798

Callers

nothing calls this directly

Calls 4

pathsMethod · 0.95
removePathMethod · 0.95
removePathsMethod · 0.95
PathMatcherMethod · 0.80

Tested by

no test coverage detected