diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-21 20:10:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 20:10:06 -0700 |
commit | 9f0889d54151d681b854cff23a03c51cf2ed0afd (patch) | |
tree | 73302db920e0738a606131631b661feb9a132a7b /test/netlib/test_multidict.py | |
parent | 6dcdc89857f4459298b5e63f2e5c7dbc793e5a2d (diff) | |
parent | 798759d2b3974eaa7afbaab7c9678e8f66dc1be6 (diff) | |
download | mitmproxy-9f0889d54151d681b854cff23a03c51cf2ed0afd.tar.gz mitmproxy-9f0889d54151d681b854cff23a03c51cf2ed0afd.tar.bz2 mitmproxy-9f0889d54151d681b854cff23a03c51cf2ed0afd.zip |
Merge pull request #1399 from mhils/fix-cv-cache-invalidation
Fix content view cache invalidation
Diffstat (limited to 'test/netlib/test_multidict.py')
-rw-r--r-- | test/netlib/test_multidict.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py index 038441e7..58ae0f98 100644 --- a/test/netlib/test_multidict.py +++ b/test/netlib/test_multidict.py @@ -45,7 +45,7 @@ class TestMultiDict(object): assert md["foo"] == "bar" with tutils.raises(KeyError): - md["bar"] + assert md["bar"] md_multi = TMultiDict( [("foo", "a"), ("foo", "b")] @@ -101,6 +101,15 @@ class TestMultiDict(object): assert TMultiDict() != self._multi() assert TMultiDict() != 42 + def test_hash(self): + """ + If a class defines mutable objects and implements an __eq__() method, + it should not implement __hash__(), since the implementation of hashable + collections requires that a key's hash value is immutable. + """ + with tutils.raises(TypeError): + assert hash(TMultiDict()) + def test_get_all(self): md = self._multi() assert md.get_all("foo") == ["bar"] @@ -197,6 +206,9 @@ class TestImmutableMultiDict(object): with tutils.raises(TypeError): md.add("foo", "bar") + def test_hash(self): + assert hash(TImmutableMultiDict()) + def test_with_delitem(self): md = TImmutableMultiDict([("foo", "bar")]) assert md.with_delitem("foo").fields == () |