MCPcopy
hub / github.com/python-attrs/attrs / test_is_hashable

Method test_is_hashable

tests/test_validators.py:456–469  ·  tests/test_validators.py::TestIn_.test_is_hashable

`in_` is hashable, so fields using it can be used with the include and exclude filters.

(self)

Source from the content-addressed store, hash-verified

454 assert (class="st">"<in_ validator with options [3, 4, 5]>") == repr(v)
455
456 def test_is_hashable(self):
457 class="st">"""
458 `in_` is hashable, so fields using it can be used with the include and
459 exclude filters.
460 class="st">"""
461
462 @attr.s
463 class C:
464 x: int = attr.ib(validator=attr.validators.in_({1, 2}))
465
466 i = C(2)
467
468 attr.asdict(i, filter=attr.filters.include(lambda val: True))
469 attr.asdict(i, filter=attr.filters.exclude(lambda val: True))
470
471
472@pytest.fixture(

Callers

nothing calls this directly

Calls 1

CClass · 0.70

Tested by

no test coverage detected