Example #1
0
 def test_recursion(self):
     assert keyfilter_json(
         {
             'somelist': [{
                 'something': 'yes',
                 'otherthing': 'no'
             }, {
                 'something': 'maybe',
                 'otherthing': 'definitely'
             }],
             'something':
             'woo'
         }, lambda k: k != 'something') == {
             'somelist': [{
                 'otherthing': 'no'
             }, {
                 'otherthing': 'definitely'
             }],
         }
 def test_recursion(self):
     assert keyfilter_json({
         'somelist': [
             {
                 'something': 'yes',
                 'otherthing': 'no'
             },
             {
                 'something': 'maybe',
                 'otherthing': 'definitely'
             }
         ],
         'something': 'woo'
     }, lambda k: k != 'something') == {
         'somelist': [
             {
                 'otherthing': 'no'
             },
             {
                 'otherthing': 'definitely'
             }
         ],
     }
Example #3
0
 def test_null(self):
     assert keyfilter_json(None, lambda k: True) is None
     assert keyfilter_json(None, lambda k: False) is None
 def test_null(self):
     assert keyfilter_json(None, lambda k: True) is None
     assert keyfilter_json(None, lambda k: False) is None