Commit 6511e905 authored by Stefan Behnel's avatar Stefan Behnel

clean up test

parent f7951939
# mode: run
# ticket: 470 # ticket: 470
__doc__ = u"""
>>> func(**{'a' : 7})
True
>>> func(**SubDict())
True
>>> call_non_dict_test()
True
>>> call_non_dict_test_kw()
True
>>> call_sub_dict_test()
True
>>> call_sub_dict_test_kw()
True
"""
import sys
if sys.version_info >= (2,6):
__doc__ += u"""
>>> func(**NonDict())
True
"""
def func(**kwargs): def func(**kwargs):
"""
>>> func(**{'a' : 7})
True
>>> func(**SubDict())
True
>>> func(**NonDict())
True
"""
return type(kwargs) is dict and kwargs['a'] == 7 return type(kwargs) is dict and kwargs['a'] == 7
...@@ -37,9 +22,17 @@ class NonDict(object): ...@@ -37,9 +22,17 @@ class NonDict(object):
return ['a'] return ['a']
def call_non_dict_test(): def call_non_dict_test():
"""
>>> call_non_dict_test()
True
"""
return func(**NonDict()) return func(**NonDict())
def call_non_dict_test_kw(): def call_non_dict_test_kw():
"""
>>> call_non_dict_test_kw()
True
"""
return func(b=5, **NonDict()) return func(b=5, **NonDict())
...@@ -48,7 +41,15 @@ class SubDict(dict): ...@@ -48,7 +41,15 @@ class SubDict(dict):
self['a'] = 7 self['a'] = 7
def call_sub_dict_test(): def call_sub_dict_test():
"""
>>> call_sub_dict_test()
True
"""
return func(**SubDict()) return func(**SubDict())
def call_sub_dict_test_kw(): def call_sub_dict_test_kw():
"""
>>> call_sub_dict_test_kw()
True
"""
return func(b=5, **SubDict()) return func(b=5, **SubDict())
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