diff --git a/tests/config/test_application.py b/tests/config/test_application.py index fc0ec291..bbac2743 100644 --- a/tests/config/test_application.py +++ b/tests/config/test_application.py @@ -986,6 +986,14 @@ def test_get_logger_after_application(): assert traitlets.log.get_logger() is fallback +def test_application_get_type_hints(): + import typing + + hints = typing.get_type_hints(Application) + assert "subcommands" in hints + assert "argv" in hints + + if __name__ == "__main__": # for test_help_output: MyApp.launch_instance() diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py index 2cc239c1..26831773 100644 --- a/traitlets/traitlets.py +++ b/traitlets/traitlets.py @@ -3880,7 +3880,7 @@ def subclass_init(self, cls: type[t.Any]) -> None: # to opt out of instance_init -class Dict(Instance["dict[K, V]"]): +class Dict(Instance["dict[K, V]"], t.Generic[K, V]): """An instance of a Python dict. One or more traits can be passed to the constructor