def test_inheritance_replace_root_validator():
    """
    We promise that if you add a validator
    with the same _function_ name as an existing validator
    it replaces the existing validator and is run instead of it.
    """

    with pytest.warns(PydanticDeprecatedSince20):

        class Parent(BaseModel):
            a: list[str]

            @root_validator(skip_on_failure=True)
            def parent_val_before(cls, values: dict[str, Any]):
                values['a'].append('parent before')
                return values

            @root_validator(skip_on_failure=True)
            def val(cls, values: dict[str, Any]):
                values['a'].append('parent')
                return values

            @root_validator(skip_on_failure=True)
            def parent_val_after(cls, values: dict[str, Any]):
                values['a'].append('parent after')
                return values

        class Child(Parent):
            @root_validator(skip_on_failure=True)
            def child_val_before(cls, values: dict[str, Any]):
                values['a'].append('child before')
                return values

            @root_validator(skip_on_failure=True)
            def val(cls, values: dict[str, Any]):
                values['a'].append('child')
                return values

            @root_validator(skip_on_failure=True)
            def child_val_after(cls, values: dict[str, Any]):
                values['a'].append('child after')
                return values

    assert Parent(a=[]).a == ['parent before', 'parent', 'parent after']
    assert Child(a=[]).a == ['parent before', 'child', 'parent after', 'child before', 'child after']

    We promise that if you add a validator
    with the same _function_ name as an existing validator
    it replaces the existing validator and is run instead of it.
    
tests/test_validators.py