Ejemplo n.º 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'
             }],
         }
Ejemplo n.º 2
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'
             }
         ],
     }
Ejemplo n.º 3
0
 def test_null(self):
     assert keyfilter_json(None, lambda k: True) is None
     assert keyfilter_json(None, lambda k: False) is None
Ejemplo n.º 4
0
 def test_null(self):
     assert keyfilter_json(None, lambda k: True) is None
     assert keyfilter_json(None, lambda k: False) is None