def test_pep695_with_nested_scopes(create_module):
    """Nested scopes generally cannot be caught by `parent_frame_namespace`,
    so currently this test is expected to fail.
    """

    module = create_module(
        """
from __future__ import annotations
from pydantic import validate_call

class A[T]:
    def g(self):
        @validate_call(validate_return=True)
        def inner(a: T) -> T: ...

    def h[S](self):
        @validate_call(validate_return=True)
        def inner(a: T) -> S: ...
        """
    )

    A = module.A
    a = A[int]()
    with pytest.raises(NameError):
        a.g()
    with pytest.raises(NameError):
        a.h()

    with pytest.raises(NameError):
        create_module(
            """
from __future__ import annotations
from pydantic import validate_call

class A[T]:
    class B:
        @validate_call(validate_return=True)
        def f(a: T) -> T: ...

    class C[S]:
        @validate_call(validate_return=True)
        def f(a: T) -> S: ...
            """
        )
Nested scopes generally cannot be caught by `parent_frame_namespace`,
    so currently this test is expected to fail.
    
tests/test_validate_call.py