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

Method testSerialising

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

Source from the content-addressed store, hash-verified

107 self.assertEqual( a(), IECore.IntData( 300 ) )
108
109 def testSerialising( self ) :
110
111 a = IECore.ClassLoader( IECore.SearchPath( os.path.join( "test", "IECore", "ops" ) ) ).load( "parameterTypes" )()
112
113 IECore.ParameterParser().parse( [
114 "-a", "10",
115 "-b", "20.2",
116 "-c", "40.5",
117 "-d", "hello",
118 "-e", "2", "4", "5",
119 "-f", "one", "two", "three", "\\-1", "\\-dash", "\\\\-slashDash", "\\\\\\-slashSlashDash", "inline-dash",
120 "-g", "2", "4",
121 "-h", "1", "4", "8",
122 "-i", "2", "4",
123 "-compound.j", "1", "4", "8",
124 "-compound.k", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
125 "-l", "1", "0", "0",
126 "-m", "1", "1", "0", "1",
127 "-o", "myFile.tif",
128 "-p", "test",
129 "-q", "true",
130 "-r", "mySequence.####.tif",
131 "-s", "-1", "-2", "10", "20",
132 "-t", "-1", "-2", "-3", "10", "20", "30",
133 "-u", "64", "128",
134 "-v", "25", "26", "27",
135 "-w", "0-500x250",
136 "-x", '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', 'Default', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
137 "-y", '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', 'Default', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
138 ], a.parameters() )
139
140 a()
141
142 # remove some parameters that don't have serializing/parsing methods yet.
143 for name in [ 'p1', 'p2', 'p3', 'p4' ] :
144 a.parameters().removeParameter( name )
145
146 s = IECore.ParameterParser().serialise( a.parameters() )
147 a = IECore.ClassLoader( IECore.SearchPath( os.path.join( "test", "IECore", "ops" ) ) ).load( "parameterTypes" )()
148 IECore.ParameterParser().parse( s, a.parameters() )
149
150 a()
151
152 # test alternate serialisation (without validation)
153 notValidated = IECore.ParameterParser().serialise( a.parameters(), values = a.parameters().getValue() )
154 IECore.ParameterParser().parse( notValidated, a.parameters() )
155
156 a()
157
158 def testSerialisingNonValidParameterValues( self ) :
159

Callers

nothing calls this directly

Calls 8

SearchPathMethod · 0.80
joinMethod · 0.80
removeParameterMethod · 0.80
serialiseMethod · 0.80
loadMethod · 0.45
parseMethod · 0.45
parametersMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected