Verify that __attrs_pre_init__ gets called with extra args if defined.
(self)
| 738 | |
| 739 | @pytest.mark.usefixtures("with_and_without_validation") |
| 740 | def test_pre_init_args(self): |
| 741 | """ |
| 742 | Verify that __attrs_pre_init__ gets called with extra args if defined. |
| 743 | """ |
| 744 | |
| 745 | @attr.s |
| 746 | class C: |
| 747 | x = attr.ib() |
| 748 | |
| 749 | def __attrs_pre_init__(self2, x): |
| 750 | self2.z = x + 1 |
| 751 | |
| 752 | c = C(x=10) |
| 753 | |
| 754 | assert 11 == getattr(c, "z", None) |
| 755 | |
| 756 | @pytest.mark.usefixtures("with_and_without_validation") |
| 757 | def test_pre_init_kwargs(self): |