You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I am not sure if that's that right place to ask, so if I've made a mistake please forgive me.
I'd like to add type annotations to a package I develop. However I cannot wrap my head around testing part. I know I can use mypy directly to check if annotations are consistent, as typeshed project does.
However I'd be more comfortable with more comprehensive coverage to be confident that my annotations really express what I need.
Let's say I have:
deffoo(x: int, y: int) ->int: ....
I'd like to be able to express both positive
foo(1, 2) # typecheck: should pass
and negative test cases:
foo(1, "bar") # typecheck: should fail
Are there any established patterns for managing such test cases?
For the positive ones I can imagine some workarounds (like testing against examples or doctests), but it won't cut it for the negative cases.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Hi. I am not sure if that's that right place to ask, so if I've made a mistake please forgive me.
I'd like to add type annotations to a package I develop. However I cannot wrap my head around testing part. I know I can use mypy directly to check if annotations are consistent, as typeshed project does.
However I'd be more comfortable with more comprehensive coverage to be confident that my annotations really express what I need.
Let's say I have:
I'd like to be able to express both positive
and negative test cases:
Are there any established patterns for managing such test cases?
For the positive ones I can imagine some workarounds (like testing against examples or doctests), but it won't cut it for the negative cases.
Thanks in advance.
The text was updated successfully, but these errors were encountered: