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
Copy file name to clipboardExpand all lines: tests/v/test_typing_fluent.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,4 +48,4 @@
48
48
49
49
c = Converter()
50
50
51
-
v.customize(c, A, v.V(f(A).a).ensure(v.len_between(0, 10))) # E: Argument 1 to "ensure" of "V" has incompatible type "Callable[[Sized], None]"; expected "Callable[[int], bool | None]" [arg-type]
51
+
v.customize(c, A, v.V(f(A).a).ensure(v.len_between(0, 10))) # E: Argument 1 to "ensure" of "V" has incompatible type "Callable[[Sized], None]"; expected "Callable[[int], bool | None] | Callable[[bool], Callable[[int], None]]" [arg-type]
Copy file name to clipboardExpand all lines: tests/v/test_typing_validators.yml
+28-1Lines changed: 28 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -61,4 +61,31 @@
61
61
62
62
c = Converter()
63
63
64
-
v.customize(c, A, v.V(fields(A).a).ensure(v.is_unique)) # E: Argument 1 to "ensure" of "V" has incompatible type "Callable[[Collection[Hashable]], None]"; expected "Callable[[list[dict[Any, Any]]], bool | None]" [arg-type]
64
+
v.customize(c, A, v.V(fields(A).a).ensure(v.is_unique)) # E: Argument 1 to "ensure" of "V" has incompatible type "Callable[[Collection[Hashable]], None]"; expected "Callable[[list[dict[Any, Any]]], bool | None] | Callable[[bool], Callable[[list[dict[Any, Any]]], None]]" [arg-type]
65
+
66
+
- case: ignoring_none
67
+
main: |
68
+
from attrs import define, fields
69
+
from cattrs import v, Converter
70
+
71
+
@define
72
+
class A:
73
+
a: int | None
74
+
75
+
c = Converter()
76
+
77
+
v.customize(c, A, v.V(fields(A).a).ensure(v.ignoring_none(v.greater_than(5))))
78
+
79
+
- case: ignoring_none_missing
80
+
main: |
81
+
from attrs import define, fields
82
+
from cattrs import v, Converter
83
+
84
+
@define
85
+
class A:
86
+
a: int | None
87
+
88
+
c = Converter()
89
+
90
+
v.customize(c, A, v.V(fields(A).a).ensure(v.greater_than(5))) # E: Argument 1 to "ensure" of "V" has incompatible type "Callable[[int], None]"; expected "Callable[[int | None], bool | None] | Callable[[bool], Callable[[int | None], None]]" [arg-type]
91
+
v.customize(c, A, v.V(fields(A).a).ensure(v.ignoring_none(v.len_between(0, 5)))) # E: Argument 1 to "ignoring_none" has incompatible type "Callable[[Sized], None]"; expected "Callable[[int], None]" [arg-type]
0 commit comments