Fix comments.
This commit is contained in:
parent
cd80208187
commit
17a48c3bc3
|
@ -22,7 +22,9 @@ def asdict(inst, recurse=True, filter=None, dict_factory=dict):
|
|||
value as the second argument.
|
||||
:type filer: callable
|
||||
|
||||
:param dict_factory: A callable to produce dictionaries from.
|
||||
:param dict_factory: A callable to produce dictionaries from. For example,
|
||||
to produce ordered dictionaries instead of normal Python dictionaries,
|
||||
pass in ``collections.OrderedDict``.
|
||||
:type dict_factory: callable
|
||||
|
||||
:rtype: :class:`dict`
|
||||
|
|
|
@ -47,6 +47,9 @@ class TestSimpleClass(object):
|
|||
|
||||
|
||||
def create_class(attrs):
|
||||
"""
|
||||
A helper function for Hypothesis to generate attrs classes.
|
||||
"""
|
||||
# What if we get more than len(string.ascii_lowercase) attributes?
|
||||
return make_class('HypClass', dict(zip(string.ascii_lowercase, attrs)))
|
||||
|
||||
|
|
|
@ -89,7 +89,9 @@ class TestAsDict(object):
|
|||
|
||||
@given(simple_classes, st.sampled_from([dict, OrderedDict]))
|
||||
def test_roundtrip(self, cls, dict_factory):
|
||||
"""Test roundtripping for Hypothesis-generated classes."""
|
||||
"""
|
||||
Test roundtripping for Hypothesis-generated classes.
|
||||
"""
|
||||
instance = cls()
|
||||
dict_instance = asdict(instance, dict_factory=dict_factory)
|
||||
|
||||
|
@ -101,7 +103,9 @@ class TestAsDict(object):
|
|||
|
||||
@given(simple_classes)
|
||||
def test_asdict_preserve_order(self, cls):
|
||||
"""When dumping to OrderedDict, field order should be preserved."""
|
||||
"""
|
||||
Field order should be preserved when dumping to OrderedDicts.
|
||||
"""
|
||||
instance = cls()
|
||||
dict_instance = asdict(instance, dict_factory=OrderedDict)
|
||||
|
||||
|
|
Loading…
Reference in New Issue