Hypothesis integration
还没有人认领这个 Issue。
评估
调研方向
首先阅读所引用的 returns/contrib/hypothesis/laws.py,并将其与本项目中现有的 typeclass 和 mypy 检查进行比较。定义提议的 check_typeclass 策略及其 allow_instances、allow_protocols 和 allow_unknown 选项,然后验证受支持的情况会产生有效的返回类型,而不受支持的情况会产生 NotImplementedError。
由索引模型根据 Issue 内容生成。
描述
Right now we don't test classes with hypothesis at all.
But, I have a great idea (at least it seems to me like so) of adding a hypothesis plugin, similar to one we have in returns: https://github.com/dry-python/returns/blob/master/returns/contrib/hypothesis/laws.py
What should it do?
check_typeclass(typeclass_instance)will check that for all existing types and protocols some valid return type is produced. For example,@typeclass def some(instance) -> strmust producestrfor allinstance,protocol, and supported types and it must produceNotImplementedErrorfor types that are not supported- Looks like
check_typeclassmust haveallow_instances,allow_protocols,allow_unknownkwboolarguments to configure what types we actually need in a resulting strategy
It would be a nice companion to our mypy check.
@Zac-HD do you like it? Maybe you have any other ideas?
- 主要语言
- Python
- 星标
- 730
- 派生
- 30
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dry-python/classes 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
dry-python/classes#496 ·
-
bug
难度 2/5 1-3 小时 新手友好度 45/100
dry-python/classes#494 ·
-
bug
难度 2/5 1-3 小时 新手友好度 52/100
dry-python/classes#492 · 2 条评论 ·
-
bug
难度 3/5 1-2 天 新手友好度 35/100
dry-python/classes#481 · 5 条评论 · 4 个 reaction ·
-
bug
难度 2/5 1-3 小时 新手友好度 35/100
dry-python/classes#386 ·
查看 dry-python/classes 的全部 Issue
相似的 Issue
-
Add: hunch 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 68/100
DiamondLightSource/dodal#2211 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
openml/openml-python#1749 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
sipyourdrink-ltd/bernstein#6191 ·