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

Method testObjectParsing

test/IECore/ParameterParser.py:434–463  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

432 IECore.ParameterParser().parse( ["-testName", "18:12:32" ], p )
433
434 def testObjectParsing( self ) :
435
436 defaultValue = IECore.CompoundObject( {
437 "a" : IECore.IntVectorData( [ 4 ] ),
438 "b" : IECore.IntVectorData( [ 5 ] ),
439 } )
440
441 p = IECore.CompoundParameter(
442 members = [
443 IECore.CompoundObjectParameter(
444 name = "testName",
445 description = "testName description",
446 defaultValue = defaultValue,
447 ),
448 ]
449 )
450
451 s = IECore.ParameterParser().serialise( p )
452 v = p["testName"].getValue().copy()
453
454 testValue = IECore.CompoundObject( {
455 "a" : IECore.IntVectorData( [ 0 ] ),
456 "b" : IECore.IntVectorData( [ 1 ] ),
457 } )
458 p["testName"].setValue( testValue )
459 self.assertNotEqual( p["testName"].getValue(), v )
460
461 IECore.ParameterParser().parse( s, p )
462
463 self.assertEqual( p["testName"].getValue(), v )
464
465 def testEmptyVector( self ) :
466 """ Test that serializing then parsing a vector with no elements in it succeeds """

Callers

nothing calls this directly

Calls 7

CompoundObjectMethod · 0.80
CompoundParameterMethod · 0.80
serialiseMethod · 0.80
copyMethod · 0.45
getValueMethod · 0.45
setValueMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected