diff --git a/dpath/__init__.py b/dpath/__init__.py index be61ddb..5c9faca 100644 --- a/dpath/__init__.py +++ b/dpath/__init__.py @@ -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) diff --git a/tests/test_get_values.py b/tests/test_get_values.py index 9eeef82..2ae506b 100644 --- a/tests/test_get_values.py +++ b/tests/test_get_values.py @@ -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 = {