I have an attrs class:
@attr.s
class Example:
my_int = attr.ib(validator=attr.validator.instance_of(MyComplexType))
I need to mock this validator.
I have an attrs class:
@attr.s
class Example:
my_int = attr.ib(validator=attr.validator.instance_of(MyComplexType))
I need to mock this validator.
Since everything after initialization is baked and immutable, mocking is not gonna work I think. However you you can temporarily disable validators using attr.set_run_validators().
You might try subclassing Example and overriding my_int with your mock validator, assuming you can control the instantiation of the object from your test.