Skip to content

Commit f465cc8

Browse files
committed
hypothesis: add type test.
1 parent 31669c2 commit f465cc8

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

typesafety/test_contrib/test_hypothesis/test_laws/test_check_all_laws.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,34 @@
4141
check_all_laws(Result)
4242
check_all_laws(Result, use_init=True)
4343
check_all_laws(Result, container_strategy=st.builds(Success, st.integers()))
44-
check_all_laws( # E: No overload variant of "check_all_laws" matches argument types "Type[Result[_ValueType_co, _ErrorType_co]]", "bool", "SearchStrategy[Success[Any]]" [call-overload] # N: Possible overload variants: # N: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, settings_kwargs: Optional[Dict[str, Any]] = ..., container_strategy: Optional[Union[SearchStrategy[Example_co], Callable[[Type[Example_co]], SearchStrategy[Example_co]]]] = ...) -> None # N: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, settings_kwargs: Optional[Dict[str, Any]] = ..., use_init: bool = ...) -> None
44+
check_all_laws(
4545
Result, use_init=True, container_strategy=st.builds(Success, st.integers())
4646
)
47+
48+
out: |
49+
main:8: error: No overload variant of "check_all_laws" matches argument types "Type[Result[_ValueType_co, _ErrorType_co]]", "bool", "SearchStrategy[Success[Any]]" [call-overload]
50+
main:8: note: Possible overload variants:
51+
main:8: note: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, container_strategy: Union[SearchStrategy[Example_co], Callable[[Type[Example_co]], SearchStrategy[Example_co]]], settings_kwargs: Optional[Dict[str, Any]] = ..., other_strategies: Optional[Dict[Type[object], Union[SearchStrategy[Any], Callable[[Type[Any]], SearchStrategy[Any]]]]] = ...) -> None
52+
main:8: note: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, settings_kwargs: Optional[Dict[str, Any]] = ..., use_init: bool = ...) -> None
53+
54+
- case: test_all_laws_requires_container_strategy
55+
disable_cache: false
56+
# TODO: remove this config after
57+
# mypy/typeshed/stdlib/unittest/mock.pyi:120:
58+
# error: Class cannot subclass "Any" (has type "Any")
59+
# is fixed.
60+
mypy_config:
61+
disallow_subclassing_any = False
62+
main: |
63+
from hypothesis import strategies as st
64+
from returns.contrib.hypothesis.laws import check_all_laws
65+
from returns.result import Result, Success
66+
67+
check_all_laws(Result, container_strategy=st.builds(Success, st.integers()), other_strategies={int: st.integers()})
68+
check_all_laws(Result, other_strategies={int: st.integers()})
69+
70+
out: |
71+
main:6: error: No overload variant of "check_all_laws" matches argument types "Type[Result[_ValueType_co, _ErrorType_co]]", "Dict[Type[int], SearchStrategy[int]]" [call-overload]
72+
main:6: note: Possible overload variants:
73+
main:6: note: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, container_strategy: Union[SearchStrategy[Example_co], Callable[[Type[Example_co]], SearchStrategy[Example_co]]], settings_kwargs: Optional[Dict[str, Any]] = ..., other_strategies: Optional[Dict[Type[object], Union[SearchStrategy[Any], Callable[[Type[Any]], SearchStrategy[Any]]]]] = ...) -> None
74+
main:6: note: def [Example_co] check_all_laws(container_type: Type[Lawful[Example_co]], *, settings_kwargs: Optional[Dict[str, Any]] = ..., use_init: bool = ...) -> None

0 commit comments

Comments
 (0)