def test_forward_ref_in_class_parameter() -> None:
    """https://github.com/pydantic/pydantic/issues/11854"""
    T = TypeVar('T')

    class Model(BaseModel, Generic[T]):
        f: T

    M = Model[list['Undefined']]

    assert not M.__pydantic_fields_complete__

    M.model_rebuild(_types_namespace={'Undefined': int})

    assert M.__pydantic_fields_complete__
    assert M.model_fields['f'].annotation == list[int]
https://github.com/pydantic/pydantic/issues/11854
tests/test_forward_ref.py