@@ -167,9 +167,10 @@ def testPipelineShouldSucceed(self):
167167 p = rj .pipeline ()
168168 p .jsonset ('foo' , Path .rootPath (), 'bar' )
169169 p .jsonget ('foo' )
170+ p .jsonget ('bar' )
170171 p .jsondel ('foo' )
171172 p .exists ('foo' )
172- self .assertListEqual ([True , 'bar' , 1 , False ], p .execute ())
173+ self .assertListEqual ([True , 'bar' , None , 1 , False ], p .execute ())
173174
174175 def testCustomEncoderDecoderShouldSucceed (self ):
175176 "Test a custom encoder and decoder"
@@ -209,6 +210,21 @@ def decode(self, obj):
209210 # Check the custom encoder
210211 self .assertTrue (rj .jsonset ('cus' , Path .rootPath (),
211212 CustomClass ('foo' , 'bar' )))
213+ # Check the custom decoder
214+ obj = rj .jsonget ('cus' , Path .rootPath ())
215+ self .assertIsNotNone (obj )
216+ self .assertEqual (CustomClass , obj .__class__ )
217+ self .assertEqual ('foo' , obj .key )
218+ self .assertEqual ('bar' , obj .val )
219+
220+ # Test resetting the decoder after the client have been created
221+ rj .setDecoder (json .JSONDecoder ())
222+ obj = rj .jsonget ('cus' , Path .rootPath ())
223+ self .assertIsNotNone (obj )
224+ self .assertNotEqual (CustomClass , obj .__class__ )
225+
226+ # Test setting the decoder after the client have been created
227+ rj .setDecoder (TestDecoder ())
212228 obj = rj .jsonget ('cus' , Path .rootPath ())
213229 self .assertIsNotNone (obj )
214230 self .assertEqual (CustomClass , obj .__class__ )
0 commit comments