def random_or_specified_value(cls, value):
"""
Helper utility for choosing between a user-specified value for a field or a randomly generated value.
:param value: Either a lambda type or a non-lambda type.
:return: The value itself if not a lambda type, otherwise the value of the evaluated lambda (random value)
"""
return value() if isinstance(value, types.LambdaType) else value
评论列表
文章目录