-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
3.2.0 (2017-09-xx) | ||
3.2.0 (2017-09-17) | ||
------------------ | ||
|
||
* Fix pickling (#134) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import copy | ||
import pytest | ||
|
||
from multidict._multidict import (MultiDict, CIMultiDict, | ||
MultiDictProxy, CIMultiDictProxy) | ||
from multidict._multidict_py import (MultiDict as PyMultiDict, | ||
CIMultiDict as PyCIMultiDict, | ||
MultiDictProxy as PyMultiDictProxy, | ||
CIMultiDictProxy as PyCIMultiDictProxy) | ||
|
||
|
||
@pytest.fixture(params=[MultiDict, PyMultiDict, | ||
CIMultiDict, PyCIMultiDict], | ||
ids=['MultiDict', 'PyMultiDict', | ||
'CIMultiDict', 'PyCIMultiDict']) | ||
def cls(request): | ||
return request.param | ||
|
||
|
||
@pytest.fixture(params=[(MultiDictProxy, MultiDict), | ||
(PyMultiDictProxy, PyMultiDict), | ||
(CIMultiDictProxy, CIMultiDict), | ||
(PyCIMultiDictProxy, PyCIMultiDict)], | ||
ids=['MultiDictProxy', 'PyMultiDictProxy', | ||
'CIMultiDictProxy', 'PyCIMultiDictProxy']) | ||
def proxy_classes(request): | ||
return request.param | ||
|
||
|
||
def test_copy(cls): | ||
d = cls() | ||
d['foo'] = 6 | ||
d2 = d.copy() | ||
d2['foo'] = 7 | ||
assert d['foo'] == 6 | ||
assert d2['foo'] == 7 | ||
|
||
|
||
def test_copy_proxy(proxy_classes): | ||
proxy_cls, dict_cls = proxy_classes | ||
d = dict_cls() | ||
d['foo'] = 6 | ||
p = proxy_cls(d) | ||
d2 = p.copy() | ||
d2['foo'] = 7 | ||
assert d['foo'] == 6 | ||
assert p['foo'] == 6 | ||
assert d2['foo'] == 7 | ||
|
||
|
||
def test_copy_std_copy(cls): | ||
d = cls() | ||
d['foo'] = 6 | ||
d2 = copy.copy(d) | ||
d2['foo'] = 7 | ||
assert d['foo'] == 6 | ||
assert d2['foo'] == 7 | ||
|
||
|
||
def test_ci_multidict_clone(cls): | ||
d = cls(foo=6) | ||
d2 = cls(d) | ||
d2['foo'] = 7 | ||
assert d['foo'] == 6 | ||
assert d2['foo'] == 7 |