From 95b0cdcb5e91a8d592a7fa44842558110219bd6f Mon Sep 17 00:00:00 2001 From: Peter Law Date: Wed, 18 Mar 2020 22:15:32 +0000 Subject: [PATCH] Add test for child of specialised generic --- test/completion/pep0484_generic_parameters.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/completion/pep0484_generic_parameters.py b/test/completion/pep0484_generic_parameters.py index dca64299..efc7c926 100644 --- a/test/completion/pep0484_generic_parameters.py +++ b/test/completion/pep0484_generic_parameters.py @@ -223,6 +223,21 @@ first(specialised_instance) values(specialised_instance)[0] +# Test that classes which have gneeric ancestry but neither they nor their +# parents are not generic are still inferred correctly. +class ChildOfSpecialised(Specialised): + pass + + +child_of_specialised_instance = NotImplemented # type: ChildOfSpecialised + +#? int() +first(child_of_specialised_instance) + +#? str() +values(child_of_specialised_instance)[0] + + # Test that unbound generics are inferred as much as possible class CustomPartialGeneric1(Mapping[str, T]): pass