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

Method test

test/IECore/Parameters.py:567–592  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

565class TestValidatedStringParameter( unittest.TestCase ) :
566
567 def test( self ) :
568
569 p = IECore.ValidatedStringParameter(
570 name = "n",
571 description = "d",
572 regex = "[0-9]*",
573 regexDescription = "Value must be an integer",
574 presets = (
575 ( "100", "100" ),
576 ( "200", "200" ),
577 )
578 )
579
580 self.assertEqual( p.name, "n" )
581 self.assertEqual( p.description, "d" )
582 self.assertEqual( p.regex, "[0-9]*" )
583 self.assertEqual (p.userData(), IECore.CompoundObject() )
584
585 self.assertRaises( RuntimeError, p.setValidatedValue, IECore.StringData( "A" ) )
586 p.setValue( IECore.StringData( "100" ) )
587 self.assertEqual( p.getValue(), IECore.StringData( "100" ) )
588
589 pr = p.getPresets()
590 self.assertEqual( len( pr ), 2 )
591 self.assertTrue( "100" in pr.keys() )
592 self.assertTrue( "200" in pr.keys() )
593
594 def testUserData( self ):
595 compound = IECore.CompoundObject()

Callers

nothing calls this directly

Calls 7

CompoundObjectMethod · 0.80
lenFunction · 0.50
userDataMethod · 0.45
setValueMethod · 0.45
getValueMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected