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

Method testSetGeometricInterpretation

test/IECore/DataAlgoTest.py:52–74  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

50 self.assertEqual( IECore.GeometricData.Interpretation.None_, IECore.getGeometricInterpretation( IECore.StringData( "foo" ) ) )
51
52 def testSetGeometricInterpretation( self ) :
53
54 v = IECore.V3fVectorData( [] )
55 self.assertEqual( IECore.GeometricData.Interpretation.None_, IECore.getGeometricInterpretation( v ) )
56 IECore.setGeometricInterpretation( v, IECore.GeometricData.Interpretation.Vector )
57 self.assertEqual( IECore.GeometricData.Interpretation.Vector, IECore.getGeometricInterpretation( v ) )
58 IECore.setGeometricInterpretation( v, IECore.GeometricData.Interpretation.Normal )
59 self.assertEqual( IECore.GeometricData.Interpretation.Normal, IECore.getGeometricInterpretation( v ) )
60
61 v = IECore.V3fData( imath.V3f( 0 ) )
62 self.assertEqual( IECore.GeometricData.Interpretation.None_, IECore.getGeometricInterpretation( v ) )
63 IECore.setGeometricInterpretation( v, IECore.GeometricData.Interpretation.Point )
64 self.assertEqual( IECore.GeometricData.Interpretation.Point, IECore.getGeometricInterpretation( v ) )
65 IECore.setGeometricInterpretation( v, IECore.GeometricData.Interpretation.None_ )
66 self.assertEqual( IECore.GeometricData.Interpretation.None_, IECore.getGeometricInterpretation( v ) )
67
68
69 #Setting the geometric interpretation of data that is not geometric is OK if you set it to None, but is otherwise an exception
70 IECore.setGeometricInterpretation( IECore.FloatData( 5 ), IECore.GeometricData.Interpretation.None_ )
71 IECore.setGeometricInterpretation( IECore.StringData( "foo" ), IECore.GeometricData.Interpretation.None_ )
72
73 self.assertRaises( RuntimeError, IECore.setGeometricInterpretation, IECore.FloatData( 5 ), IECore.GeometricData.Interpretation.Normal )
74 self.assertRaises( RuntimeError, IECore.setGeometricInterpretation, IECore.StringData( "foo" ), IECore.GeometricData.Interpretation.Point )
75
76 def testCanGenerateUniqueValuesForStringVectorData( self ) :
77 data = IECore.StringVectorData( ['a', 'b', 'a', 'c', 'c', 'a', 'b'] )

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected