예제 #1
0
 def test_has_key_false(self):
     data = {
         'foo': {
             'bar': {}
         }
     }
     path = 'foo.bar.sup'
     self.assertFalse(has_key(data, path))
예제 #2
0
 def test_has_key(self):
     data = {
         'foo': {
             'bar': {
                 'sup': 10
             }
         }
     }
     path = 'foo.bar.sup'
     self.assertTrue(has_key(data, path))
예제 #3
0
 def test_has_key_empty_list(self):
     data = {
         'comments': []
     }
     path = 'comments[].likes'
     self.assertTrue(has_key(data, path))