get_occurrences_and_values throws when same value in multiple dicts #34

Open
opened 2020-05-26 08:46:31 -04:00 by russellballestrini · 1 comment
russellballestrini commented 2020-05-26 08:46:31 -04:00 (Migrated from git2.unturf.com)

Created by: paultop6

l = [
{
  "item1": 1234,
  "item2": 5678,
  "item4": [1234, 9012]
},
{
  "item1": "abcd",
  "item2": "efgh",
  "item4": [1234, "adcf"]
}
]

get_occurrences_and_values(l, value=1234)

The code above will throw TypeError: 'NoneType' object is not iterable.
I beieve the recursive action is matching 1234 within the list of item4 of the second dict, where it should be matching the entire value, or perhaps some kinda of different behaviour.

*Created by: paultop6* ``` l = [ { "item1": 1234, "item2": 5678, "item4": [1234, 9012] }, { "item1": "abcd", "item2": "efgh", "item4": [1234, "adcf"] } ] get_occurrences_and_values(l, value=1234) ``` The code above will throw TypeError: 'NoneType' object is not iterable. I beieve the recursive action is matching 1234 within the list of item4 of the second dict, where it should be matching the entire value, or perhaps some kinda of different behaviour.
russellballestrini commented 2021-02-07 17:21:12 -05:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

Help wanted on fixing this one!

*Created by: russellballestrini* Help wanted on fixing this one! * current tests: https://github.com/russellballestrini/nested-lookup/blob/master/test_nested_lookup.py#L12 * tips on getting pull requests approved: https://russell.ballestrini.net/tips-for-getting-pull-requests-approved/
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: python/nested-lookup#34
No description provided.