diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-21 19:49:32 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-21 19:49:32 -0700 |
commit | 798759d2b3974eaa7afbaab7c9678e8f66dc1be6 (patch) | |
tree | 05612244e60bb091f95812a857652ae2fe8f87fd /test | |
parent | daae51823de79ca728e32d7925e239231c85e442 (diff) | |
download | mitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.tar.gz mitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.tar.bz2 mitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.zip |
fix content view cache invalidation
Diffstat (limited to 'test')
-rw-r--r-- | test/netlib/http/test_message.py | 4 | ||||
-rw-r--r-- | test/netlib/test_multidict.py | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/test/netlib/http/test_message.py b/test/netlib/http/test_message.py index deebd6f2..7f93830e 100644 --- a/test/netlib/http/test_message.py +++ b/test/netlib/http/test_message.py @@ -71,10 +71,6 @@ class TestMessage(object): assert resp != 0 - def test_hash(self): - resp = tresp() - assert hash(resp) - def test_serializable(self): resp = tresp() resp2 = http.Response.from_state(resp.get_state()) 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 == () |