We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fbdd17a + dc3f5d9 commit 22b6c01Copy full SHA for 22b6c01
dpath/__init__.py
@@ -167,7 +167,7 @@ def get(
167
If more than one leaf matches the glob, ValueError is raised. If the glob is
168
not found and a default is not provided, KeyError is raised.
169
"""
170
- if glob == "/":
+ if isinstance(glob, str) and glob == "/" or len(glob) == 0:
171
return obj
172
173
globlist = _split_path(glob, separator)
tests/test_get_values.py
@@ -17,6 +17,9 @@ def test_util_get_root():
17
ret = dpath.get(x, '/')
18
assert ret == x
19
20
+ ret = dpath.get(x, [])
21
+ assert ret == x
22
+
23
24
def test_get_explicit_single():
25
ehash = {
0 commit comments