def dict_typed_attrs(draw, defaults=None):
"""
Generate a tuple of an attribute and a strategy that yields dictionaries
for that attribute. The dictionaries map strings to integers.
"""
default = attr.NOTHING
val_strat = dictionaries(keys=text(), values=integers())
if defaults is True or (defaults is None and draw(booleans())):
default = draw(val_strat)
return ((attr.ib(type=Dict[unicode, int], default=default), val_strat))
评论列表
文章目录