Verify that __attrs_post_init__ gets called if defined.
(self)
| 854 | |
| 855 | @pytest.mark.usefixtures("with_and_without_validation") |
| 856 | def test_post_init(self): |
| 857 | """ |
| 858 | Verify that __attrs_post_init__ gets called if defined. |
| 859 | """ |
| 860 | |
| 861 | @attr.s |
| 862 | class C: |
| 863 | x = attr.ib() |
| 864 | y = attr.ib() |
| 865 | |
| 866 | def __attrs_post_init__(self2): |
| 867 | self2.z = self2.x + self2.y |
| 868 | |
| 869 | c = C(x=10, y=20) |
| 870 | |
| 871 | assert 30 == getattr(c, "z", None) |
| 872 | |
| 873 | @pytest.mark.usefixtures("with_and_without_validation") |
| 874 | def test_pre_post_init_order(self): |