File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
tests/test_contrib/test_hypothesis/test_laws Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ strictness = long
96
96
# ignores some directories:
97
97
norecursedirs = *.egg .eggs dist build docs .tox .git __pycache__
98
98
99
+ # Active the strict mode of xfail
100
+ xfail_strict = true
101
+
99
102
# Adds these options to each `pytest` run:
100
103
addopts =
101
104
--doctest-modules
Original file line number Diff line number Diff line change
1
+ from typing import Callable , TypeVar
2
+
3
+ import pytest
4
+
5
+ from returns .contrib .hypothesis .laws import check_all_laws
6
+ from returns .interfaces import mappable
7
+ from returns .primitives .container import BaseContainer
8
+ from returns .primitives .hkt import SupportsKind1
9
+
10
+ pytestmark = pytest .mark .xfail
11
+
12
+ _ValueType = TypeVar ('_ValueType' )
13
+ _NewValueType = TypeVar ('_NewValueType' )
14
+
15
+
16
+ class _Wrapper (
17
+ BaseContainer ,
18
+ SupportsKind1 ['_Wrapper' , _ValueType ],
19
+ mappable .Mappable1 [_ValueType ],
20
+ ):
21
+ _inner_value : _ValueType
22
+
23
+ def __init__ (self , inner_value : _ValueType ) -> None :
24
+ super ().__init__ (inner_value )
25
+
26
+ def map ( # noqa: WPS125
27
+ self ,
28
+ function : Callable [[_ValueType ], _NewValueType ],
29
+ ) -> '_Wrapper[_NewValueType]' :
30
+ return _Wrapper (
31
+ 'wrong-{0}' .format (function (self ._inner_value )), # type: ignore
32
+ )
33
+
34
+
35
+ check_all_laws (_Wrapper , use_init = True )
You can’t perform that action at this time.
0 commit comments