Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpath/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get(
If more than one leaf matches the glob, ValueError is raised. If the glob is
not found and a default is not provided, KeyError is raised.
"""
if glob == "/":
if isinstance(glob, str) and glob == "/" or len(glob) == 0:
return obj

globlist = _split_path(glob, separator)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_get_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def test_util_get_root():
ret = dpath.get(x, '/')
assert ret == x

ret = dpath.get(x, [])
assert ret == x


def test_get_explicit_single():
ehash = {
Expand Down