Skip to content

Commit

Permalink
Allow comparison against iterables
Browse files Browse the repository at this point in the history
For issue #8: this affected both strings and arbitrary lists
  • Loading branch information
jimrthy authored and zhemao committed Sep 30, 2015
1 parent 63c6abc commit 34d255c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion funktown/dictionary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import collections

from .lookuptree import LookupTree

import collections
Expand Down Expand Up @@ -89,7 +91,7 @@ def __eq__(self, other):
if other is None:
return False

if not hasattr(other, '__getitem__'):
if not isinstance(other, collections.Mapping):
return False

if len(self) != len(other):
Expand Down
2 changes: 1 addition & 1 deletion unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def typetest():
assert d != 'a'

assert l == v
assert d == v
assert d != v
assert d != l

if __name__ == "__main__":
Expand Down

0 comments on commit 34d255c

Please sign in to comment.