@@ -693,6 +693,30 @@ def test_help_output_redirect(self):
693693 finally :
694694 pydoc .getpager = getpager_old
695695
696+ def test_lambda_with_return_annotation (self ):
697+ func = lambda a , b , c : 1
698+ func .__annotations__ = {"return" : int }
699+ with captured_output ('stdout' ) as help_io :
700+ pydoc .help (func )
701+ helptext = help_io .getvalue ()
702+ self .assertIn ("lambda (a, b, c) -> int" , helptext )
703+
704+ def test_lambda_without_return_annotation (self ):
705+ func = lambda a , b , c : 1
706+ func .__annotations__ = {"a" : int , "b" : int , "c" : int }
707+ with captured_output ('stdout' ) as help_io :
708+ pydoc .help (func )
709+ helptext = help_io .getvalue ()
710+ self .assertIn ("lambda (a: int, b: int, c: int)" , helptext )
711+
712+ def test_lambda_with_return_and_params_annotation (self ):
713+ func = lambda a , b , c : 1
714+ func .__annotations__ = {"a" : int , "b" : int , "c" : int , "return" : int }
715+ with captured_output ('stdout' ) as help_io :
716+ pydoc .help (func )
717+ helptext = help_io .getvalue ()
718+ self .assertIn ("lambda (a: int, b: int, c: int) -> int" , helptext )
719+
696720 def test_namedtuple_fields (self ):
697721 Person = namedtuple ('Person' , ['nickname' , 'firstname' ])
698722 with captured_stdout () as help_io :
0 commit comments