Commit 73a7b44d authored by Stefan Behnel's avatar Stefan Behnel

extend dict test to match set literal sideeffect tests

parent f71c9006
...@@ -76,3 +76,29 @@ def dict_call_kwargs(): ...@@ -76,3 +76,29 @@ def dict_call_kwargs():
kwargs = dict(parrot1=u"resting", answer1=42) kwargs = dict(parrot1=u"resting", answer1=42)
d = dict(parrot2=u"resting", answer2=42, **kwargs) d = dict(parrot2=u"resting", answer2=42, **kwargs)
return d return d
def item_creation_sideeffect(L, sideeffect, unhashable):
"""
>>> def sideeffect(x):
... L.append(x)
... return x
>>> def unhashable(x):
... L.append(x)
... return [x]
>>> L = []
>>> item_creation_sideeffect(L, sideeffect, unhashable) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError:... unhashable ...
>>> L
[2, 4]
>>> L = []
>>> {1:2, sideeffect(2): 3, 3: 4, unhashable(4): 5, sideeffect(5): 6} # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError:... unhashable ...
>>> L
[2, 4]
"""
return {1:2, sideeffect(2): 3, 3: 4, unhashable(4): 5, sideeffect(5): 6}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment