We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 29b2055 commit 51fda72Copy full SHA for 51fda72
tests/test_rejson.py
@@ -209,6 +209,21 @@ def decode(self, obj):
209
# Check the custom encoder
210
self.assertTrue(rj.jsonset('cus', Path.rootPath(),
211
CustomClass('foo', 'bar')))
212
+ # Check the custom decoder
213
+ obj = rj.jsonget('cus', Path.rootPath())
214
+ self.assertIsNotNone(obj)
215
+ self.assertEqual(CustomClass, obj.__class__)
216
+ self.assertEqual('foo', obj.key)
217
+ self.assertEqual('bar', obj.val)
218
+
219
+ # Test resetting the decoder after the client have been created
220
+ rj.setDecoder(json.JSONDecoder())
221
222
223
+ self.assertNotEqual(CustomClass, obj.__class__)
224
225
+ # Test setting the decoder after the client have been created
226
+ rj.setDecoder(TestDecoder())
227
obj = rj.jsonget('cus', Path.rootPath())
228
self.assertIsNotNone(obj)
229
self.assertEqual(CustomClass, obj.__class__)
0 commit comments