Skip to content

Commit

Permalink
Merge branch 'master' into pr/191
Browse files Browse the repository at this point in the history
  • Loading branch information
moomoohk committed Jun 11, 2024
2 parents 9ffb6df + 22b6c01 commit dfd5546
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -316,7 +316,7 @@ def merger(dst, src, _segments=()):
target = segments.get(dst, current_path)

# If the types don't match, replace it.
if type(found) != type(target) and not are_both_mutable(found, target):
if type(found) is not type(target) and not are_both_mutable(found, target):
segments.set(dst, current_path, found)
continue

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 @@ -21,6 +21,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

0 comments on commit dfd5546

Please sign in to comment.