Пример #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))