If _CountingAttr.validator is used as a decorator and there is already a decorator set, the decorators are composed using `and_`.
(self, wrap)
| 120 | |
| 121 | @pytest.mark.parametrize("wrap", [lambda v: v, lambda v: [v], and_]) |
| 122 | def test_validator_decorator(self, wrap): |
| 123 | """ |
| 124 | If _CountingAttr.validator is used as a decorator and there is already |
| 125 | a decorator set, the decorators are composed using `and_`. |
| 126 | """ |
| 127 | |
| 128 | def v(_, __): |
| 129 | pass |
| 130 | |
| 131 | a = attr.ib(validator=wrap(v)) |
| 132 | |
| 133 | @a.validator |
| 134 | def v2(self, _, __): |
| 135 | pass |
| 136 | |
| 137 | assert _AndValidator((v, v2)) == a._validator |
| 138 | |
| 139 | def test_default_decorator_already_set(self): |
| 140 | """ |
nothing calls this directly
no test coverage detected