def test_model_post_init_supertype_private_attrs():
    """https://github.com/pydantic/pydantic/issues/9098"""

    class Model(BaseModel):
        _private: int = 12

    class SubModel(Model):
        def model_post_init(self, context: Any, /) -> None:
            if self._private == 12:
                self._private = 13
            super().model_post_init(context)

    m = SubModel()

    assert m._private == 13
https://github.com/pydantic/pydantic/issues/9098
tests/test_main.py