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

Method testSets

test/IECoreScene/SceneCacheTest.py:765–850  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

763 self.assertTrue( d.hasTag( "ObjectType:SpherePrimitive", IECoreScene.SceneInterface.TagFilter.EveryTag ) )
764
765 def testSets( self ):
766
767 # A
768 # B { 'don': ['/E'], 'john'; ['/F'] }
769 # E
770 # F
771 # C { 'don' : ['/'] }
772 # D { 'john' : ['/G] }
773 # G
774 # H
775 # I
776 # J
777 # K {'foo',['/L/M/N'] }
778 # L
779 # M
780 # N
781
782 writeRoot = IECoreScene.SceneCache( os.path.join( self.tempDir, "testset.scc" ), IECore.IndexedIO.OpenMode.Write )
783
784 A = writeRoot.createChild("A")
785 B = A.createChild("B")
786 C = A.createChild("C")
787 D = A.createChild("D")
788 E = B.createChild("E")
789 F = B.createChild("F")
790 G = D.createChild("G")
791
792 H = writeRoot.createChild("H")
793 I = H.createChild("I")
794 J = I.createChild("J")
795 K = J.createChild("K")
796 L = K.createChild("L")
797 M = L.createChild("M")
798 N = M.createChild("N")
799
800 B.writeSet( "don", IECore.PathMatcher( ['/E'] ) )
801 B.writeSet( "john", IECore.PathMatcher( ['/F'] ) )
802 C.writeSet( "don", IECore.PathMatcher( ['/'] ) )
803 D.writeSet( "john", IECore.PathMatcher( ['/G'] ) )
804 K.writeSet( "foo", IECore.PathMatcher( ['/L/M/N'] ) )
805
806 del N, M, L, K, J, I, H, G, F, E, D, C, B, A, writeRoot
807
808 readRoot = IECoreScene.SceneCache( os.path.join( self.tempDir, "testset.scc" ), IECore.IndexedIO.OpenMode.Read )
809
810 self.assertEqual( set(readRoot.childNames()), set (['A', 'H']) )
811
812 A = readRoot.child('A')
813
814 self.assertEqual( set( A.childNames() ), set( ['B', 'C', 'D'] ) ) # default behaviour is to look for sets in descendants.
815 B = A.child('B')
816 C = A.child('C')
817 D = A.child('D')
818 E = B.child('E')
819 F = B.child('F')
820 H = readRoot.child('H')
821
822 self.assertEqual( set( B.childNames() ), set( ['E', 'F'] ) )

Callers

nothing calls this directly

Calls 12

createChildMethod · 0.95
childNamesMethod · 0.95
childMethod · 0.95
SceneCacheMethod · 0.80
joinMethod · 0.80
PathMatcherMethod · 0.80
lenFunction · 0.50
writeSetMethod · 0.45
childMethod · 0.45
pathsMethod · 0.45
readSetMethod · 0.45
setNamesMethod · 0.45

Tested by

no test coverage detected