def test_nested_get_ll_flatten(self):
     res = nested_get(self.flatten_data, ['matches', 'goals', 'details'],
                      default=None,
                      flatten=True)
     self.assertEqual(res, [{
         'position': 'outside-box'
     }, {
         'position': 'right-side'
     }, {
         'position': 'inside-box'
     }, {
         'position': 'left-side'
     }, {
         'position': 'penalty'
     }, {
         'position': 'd-box'
     }])
 def test_nested_get_flatten(self):
     res = nested_get(self.flatten_data, ['matches', 'goals', 'scorrer'],
                      default=None,
                      flatten=True)
     self.assertEqual(res, ['Lionel Messi', 'Luis Suarez', 'C. Ronaldo'])
 def test_nested_get_with_index_error(self):
     res = nested_get(self.nested_get_data,
                      ['details', 'address', 'city', 5],
                      default=None)
     self.assertEqual(res, None)
 def test_nested_list_get_with_index_success(self):
     res = nested_get(self.nested_list_get_data,
                      ['details', 'address', 0, 0])
     self.assertEqual(res, {'city': 'Albuquerque'})
 def test_nested_ll_get_all_success(self):
     res = nested_get(self.nested_ll_get_data,
                      ['details', 'address', 'city'],
                      default=None)
     self.assertEqual(res, ['Albuquerque', 'El Paso', None])
 def test_simple_get_success(self):
     res = nested_get(self.simple_get_data, ['details', 'address', 'city'])
     self.assertEqual(res, 'Albuquerque')