mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
add MultiDictView.copy
This commit is contained in:
parent
124a6c9e5a
commit
de1de3f626
@ -230,3 +230,6 @@ class MultiDictView(_MultiDict):
|
||||
@fields.setter
|
||||
def fields(self, value):
|
||||
self._setter(value)
|
||||
|
||||
def copy(self):
|
||||
return MultiDict(self.fields)
|
||||
|
@ -205,3 +205,12 @@ class TestMultiDictView:
|
||||
tv["c"] = "b"
|
||||
assert p.vals == (("a", "b"), ("c", "b"))
|
||||
assert tv["a"] == "b"
|
||||
|
||||
def test_copy(self):
|
||||
p = TParent()
|
||||
tv = multidict.MultiDictView(p.getter, p.setter)
|
||||
c = tv.copy()
|
||||
assert isinstance(c, multidict.MultiDict)
|
||||
assert tv.items() == c.items()
|
||||
c["foo"] = "bar"
|
||||
assert tv.items() != c.items()
|
||||
|
Loading…
Reference in New Issue
Block a user