void () { PyGenericType typeVarT = new PyTypeVarTypeImpl("T", null); PyGenericType typeVarV = new PyTypeVarTypeImpl("V", null); TypeEvalContext context = TypeEvalContext.codeInsightFallback(myFixture.getProject()); PyType substituted; substituted = PyTypeChecker.substitute(typeVarT, new GenericSubstitutions(Map.of(typeVarT, typeVarT)), context); assertEquals(typeVarT, substituted); substituted = PyTypeChecker.substitute(typeVarT, new GenericSubstitutions(Map.of(typeVarT, typeVarV, typeVarV, typeVarT)), context); assertNull(substituted); PyCallableType callable = new PyCallableTypeImpl(List.of(), typeVarT); substituted = PyTypeChecker.substitute(callable, new GenericSubstitutions(Map.of(typeVarT, typeVarV, typeVarV, callable)), context); PyCallableType substitutedCallable = assertInstanceOf(substituted, PyCallableType.class); assertNull(substitutedCallable.getReturnType(context)); }