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

Class ValidatedAttribute

tests/test_setattr.py:82–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81 @attr.s(on_setattr=on_setattr)
82 class ValidatedAttribute:
83 x = attr.ib()
84 y = attr.ib(validator=[instance_of(str), matches_re("foo.*qux")])
85
86 va = ValidatedAttribute(42, "foobarqux")
87

Callers 1

test_validatorMethod · 0.85

Calls 2

instance_ofFunction · 0.90
matches_reFunction · 0.90

Tested by 1

test_validatorMethod · 0.68