Verify that __attrs_post_init__ gets called if defined.
(self)
| 872 | |
| 873 | @pytest.mark.usefixtures("with_and_without_validation") |
| 874 | def test_pre_post_init_order(self): |
| 875 | """ |
| 876 | Verify that __attrs_post_init__ gets called if defined. |
| 877 | """ |
| 878 | |
| 879 | @attr.s |
| 880 | class C: |
| 881 | x = attr.ib() |
| 882 | |
| 883 | def __attrs_pre_init__(self2): |
| 884 | self2.z = 30 |
| 885 | |
| 886 | def __attrs_post_init__(self2): |
| 887 | self2.z += self2.x |
| 888 | |
| 889 | c = C(x=10) |
| 890 | |
| 891 | assert 40 == getattr(c, "z", None) |
| 892 | |
| 893 | def test_types(self): |
| 894 | """ |