最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python hypothesis - Override type strategy for `type` generic aliases - Stack Overflow

programmeradmin2浏览0评论

Is there a way to override the type strategy for type and its generic aliases? The following snippet does not seem to work:

from hypothesis import strategies as st


def type_strat(t):
    raise ValueError(t)


st.register_type_strategy(type, type_strat)
print(st.from_type(type[int]), Rule()) # Does not raise a `ValueError`.
发布评论

评论列表(0)

  1. 暂无评论