A validator that raises a `ValueError` if the initializer is called with a value that does not belong in the options provided. The check is performed using ``value in options``. :param options: Allowed options. :type options: list, tuple, `enum.Enum`, ... :raises ValueErr
(options)
| 316 | |
| 317 | |
| 318 | def in_(options): |
| 319 | """ |
| 320 | A validator that raises a `ValueError` if the initializer is called |
| 321 | with a value that does not belong in the options provided. The check is |
| 322 | performed using ``value in options``. |
| 323 | |
| 324 | :param options: Allowed options. |
| 325 | :type options: list, tuple, `enum.Enum`, ... |
| 326 | |
| 327 | :raises ValueError: With a human readable error message, the attribute (of |
| 328 | type `attrs.Attribute`), the expected options, and the value it |
| 329 | got. |
| 330 | |
| 331 | .. versionadded:: 17.1.0 |
| 332 | """ |
| 333 | return _InValidator(options) |
| 334 | |
| 335 | |
| 336 | @attrs(repr=False, slots=False, hash=True) |
nothing calls this directly
no test coverage detected