Wanting to change an unknown attribute raises an AttrsAttributeNotFoundError.
(self, C)
| 705 | |
| 706 | @given(simple_classes()) |
| 707 | def test_unknown(self, C): |
| 708 | """ |
| 709 | Wanting to change an unknown attribute raises an |
| 710 | AttrsAttributeNotFoundError. |
| 711 | """ |
| 712 | # No generated class will have a four letter attribute. |
| 713 | with pytest.raises(TypeError) as e: |
| 714 | evolve(C(), aaaa=2) |
| 715 | |
| 716 | if hasattr(C, "__attrs_init__"): |
| 717 | expected = ( |
| 718 | "__attrs_init__() got an unexpected keyword argument 'aaaa'" |
| 719 | ) |
| 720 | else: |
| 721 | expected = "__init__() got an unexpected keyword argument 'aaaa'" |
| 722 | |
| 723 | assert e.value.args[0].endswith(expected) |
| 724 | |
| 725 | def test_validator_failure(self): |
| 726 | """ |