Skip to content

Commit

Permalink
resolves pawelzny#95 implements iter magic method
Browse files Browse the repository at this point in the history
  • Loading branch information
WiBere committed Jun 5, 2023
1 parent 8f9d535 commit d14ae23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dotty_dict/dotty_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def search_in(items, data):
return it in data

return search_in(self._split(item), self._data)

def __iter__(self):
for iteration in self._data:
yield iteration
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dotty_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def test_access_keys_from_deeply_nested_structure(self):
self.assertListEqual(keys, ['ridiculous', 'secret'])

def test_iterate(self):
keys = sorted([key for key in self.dot])
keys = sorted(key for key in self.dot)
self.assertListEqual(keys, ['deep', 'flat_key'])

def test_iterate_from_deeply_nested_structure(self):
keys = sorted([key for key in self.dot['deep.deeper']])
keys = sorted(key for key in self.dot['deep.deeper'])
self.assertListEqual(keys, ['ridiculous', 'secret'])

def test_get_value_without_default(self):
Expand Down

0 comments on commit d14ae23

Please sign in to comment.