def test_forward_ref_in_generic(create_module: Any) -> None:
    """https://github.com/pydantic/pydantic/issues/6503"""

    @create_module
    def module():
        from pydantic import BaseModel

        class Foo(BaseModel):
            x: dict['type[Bar]', type['Bar']]

        class Bar(BaseModel):
            pass

    Foo = module.Foo
    Bar = module.Bar

    assert Foo(x={Bar: Bar}).x[Bar] is Bar
https://github.com/pydantic/pydantic/issues/6503
tests/test_forward_ref.py