Silent on matches, raises ValueError on mismatches.
(self)
| 176 | assert matches_re.__name__ in validator_module.__all__ |
| 177 | |
| 178 | def test_match(self): |
| 179 | """ |
| 180 | Silent on matches, raises ValueError on mismatches. |
| 181 | """ |
| 182 | |
| 183 | @attr.s |
| 184 | class ReTester: |
| 185 | str_match = attr.ib(validator=matches_re("a|ab")) |
| 186 | |
| 187 | ReTester("ab") # shouldn't raise exceptions |
| 188 | with pytest.raises(TypeError): |
| 189 | ReTester(1) |
| 190 | with pytest.raises(ValueError): |
| 191 | ReTester("1") |
| 192 | with pytest.raises(ValueError): |
| 193 | ReTester("a1") |
| 194 | |
| 195 | def test_flags(self): |
| 196 | """ |