Skip to content

Commit

Permalink
Rename ordered_dict_intersection -> compat_dict_intersection (#3887)
Browse files Browse the repository at this point in the history
Do not use OrderedDicts any more, so name did not make sense.
  • Loading branch information
johnomotani authored Mar 24, 2020
1 parent d8bb620 commit 009aa66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions xarray/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def dict_equiv(
return True


def ordered_dict_intersection(
def compat_dict_intersection(
first_dict: Mapping[K, V],
second_dict: Mapping[K, V],
compat: Callable[[V, V], bool] = equivalent,
Expand All @@ -361,9 +361,6 @@ def ordered_dict_intersection(
Binary operator to determine if two values are compatible. By default,
checks for equivalence.
# TODO: Rename to compat_dict_intersection, as we do not use OrderedDicts
# any more.
Returns
-------
intersection : dict
Expand Down
6 changes: 3 additions & 3 deletions xarray/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def test_unsafe(self):
with pytest.raises(ValueError):
utils.update_safety_check(self.x, self.z)

def test_ordered_dict_intersection(self):
assert {"b": "B"} == utils.ordered_dict_intersection(self.x, self.y)
assert {} == utils.ordered_dict_intersection(self.x, self.z)
def test_compat_dict_intersection(self):
assert {"b": "B"} == utils.compat_dict_intersection(self.x, self.y)
assert {} == utils.compat_dict_intersection(self.x, self.z)

def test_compat_dict_union(self):
assert {"a": "A", "b": "B", "c": "C"} == utils.compat_dict_union(self.x, self.y)
Expand Down

0 comments on commit 009aa66

Please sign in to comment.