Fix for issue #19 (get_all_keys fails if dict are part of list)
This commit is contained in:
parent
4f37d265c8
commit
fdce9e685a
2 changed files with 29 additions and 13 deletions
|
|
@ -193,6 +193,16 @@ class TestGetAllKeys(TestCase):
|
|||
}]
|
||||
}]
|
||||
}
|
||||
self.sample5 = [{
|
||||
"listings": [{
|
||||
"name": "title",
|
||||
"postcode": "postcode",
|
||||
"full_address": "fulladdress",
|
||||
"city": "city",
|
||||
"lat": "latitude",
|
||||
"lng": "longitude"
|
||||
}]
|
||||
}]
|
||||
|
||||
def test_sample_data1(self):
|
||||
result = get_all_keys(self.sample1)
|
||||
|
|
@ -242,6 +252,16 @@ class TestGetAllKeys(TestCase):
|
|||
for key in keys_to_verify:
|
||||
self.assertIn(key, result)
|
||||
|
||||
def test_sample_data5(self):
|
||||
result = get_all_keys(self.sample5)
|
||||
self.assertEqual(7, len(result))
|
||||
keys_to_verify = [
|
||||
'listings', 'name', 'postcode', 'full_address', 'city',
|
||||
'lat', 'lng'
|
||||
]
|
||||
for key in keys_to_verify:
|
||||
self.assertIn(key, result)
|
||||
|
||||
|
||||
class TestGetOccurrence(TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue