Skip to content

Commit

Permalink
Fix fuzzy_equal with Python 3.7
Browse files Browse the repository at this point in the history
`functools.singledispatch` requires dispatch on types now.
  • Loading branch information
dean0x7d committed Aug 29, 2020
1 parent 4476d49 commit b7a5e35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/utils/fuzzy_equal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def wrapper(self, actual, expected, context=None):
self.stack.append(context)

is_pb_savable = any(hasattr(actual, s) for s in ['__getstate__', '__getinitargs__'])
kind = pb.save if is_pb_savable else actual.__class__
kind = type(pb.save) if is_pb_savable else actual.__class__
dispatcher.dispatch(kind)(self, actual, expected)

if context is not None and self.stack:
Expand Down Expand Up @@ -148,7 +148,7 @@ def _(self, actual, expected):
for key in actual:
self._assert(actual[key], expected[key], context="['{}']".format(key))

@_assert.register(pb.save)
@_assert.register(type(pb.save))
def _(self, actual, expected):
specials = [s for s in ['__getstate__', '__getinitargs__'] if hasattr(actual, s)]
for s in specials:
Expand Down

0 comments on commit b7a5e35

Please sign in to comment.