( self )
| 41 | class ExternalProceduralTest( unittest.TestCase ) : |
| 42 | |
| 43 | def test( self ) : |
| 44 | |
| 45 | p = IECoreScene.ExternalProcedural( |
| 46 | "yeti.so", |
| 47 | imath.Box3f( imath.V3f( 1, 2, 3 ), imath.V3f( 4, 5, 6 ) ), |
| 48 | IECore.CompoundData( { |
| 49 | "one" : 1, |
| 50 | "two" : 2, |
| 51 | } ) |
| 52 | ) |
| 53 | |
| 54 | self.assertEqual( p.getFileName(), "yeti.so" ) |
| 55 | self.assertEqual( p.getBound(), imath.Box3f( imath.V3f( 1, 2, 3 ), imath.V3f( 4, 5, 6 ) ) ) |
| 56 | self.assertEqual( |
| 57 | p.parameters(), |
| 58 | IECore.CompoundData( { |
| 59 | "one" : 1, |
| 60 | "two" : 2, |
| 61 | } ) |
| 62 | ) |
| 63 | |
| 64 | p2 = p.copy() |
| 65 | |
| 66 | self.assertEqual( p2.getFileName(), "yeti.so" ) |
| 67 | self.assertEqual( p2.getBound(), imath.Box3f( imath.V3f( 1, 2, 3 ), imath.V3f( 4, 5, 6 ) ) ) |
| 68 | self.assertEqual( |
| 69 | p2.parameters(), |
| 70 | IECore.CompoundData( { |
| 71 | "one" : 1, |
| 72 | "two" : 2, |
| 73 | } ) |
| 74 | ) |
| 75 | |
| 76 | self.assertEqual( p, p2 ) |
| 77 | self.assertEqual( p.hash(), p2.hash() ) |
| 78 | |
| 79 | p2.setFileName( "yeti2.so" ) |
| 80 | self.assertEqual( p2.getFileName(), "yeti2.so" ) |
| 81 | |
| 82 | self.assertNotEqual( p, p2 ) |
| 83 | self.assertNotEqual( p.hash(), p2.hash() ) |
| 84 | |
| 85 | m = IECore.MemoryIndexedIO( IECore.CharVectorData(), [], IECore.IndexedIO.OpenMode.Append ) |
| 86 | |
| 87 | p.save( m, "test" ) |
| 88 | |
| 89 | p3 = IECore.Object.load( m, "test" ) |
| 90 | |
| 91 | self.assertEqual( p3, p ) |
| 92 | |
| 93 | if __name__ == "__main__": |
| 94 | unittest.main() |
nothing calls this directly
no test coverage detected