Python hypothesis.strategies 模块,composite() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用hypothesis.strategies.composite()

项目:TopChef    作者:TopChef    | 项目源码 | 文件源码
def api_metadata(
        draw, maintainer_names=text(), versions=text()
) -> APIMetadataInterface:
    """

    :param draw: A function supplied by the ``@composite`` decorator,
        which knows how to draw a randomly-generated sample from the
        strategies provided by ``hypothesis``
    :param maintainer_names: A generator for maintainer names
    :param versions: A generator for API versions
    :return: A randomly-generated API Metadata model
    """
    return _APIMetadata(
        draw(maintainer_names), draw(versions)
    )