@@ -1821,48 +1821,14 @@ async def coro(self):
18211821        self .assertFalse (inspect .iscoroutinefunction (Cls .sync ))
18221822        self .assertTrue (inspect .iscoroutinefunction (Cls .coro ))
18231823
1824- 
1825- class  TestDeprecatedHelp (unittest .TestCase ):
1826-     CODE_SIMPLE  =  r""" 
1827- from warnings import deprecated 
1828- @deprecated("Test") 
1829- class A: 
1830-     pass 
1831- a = A() 
1832- """ 
1833-     CODE_SUBCLASS  =  r""" 
1834- from warnings import deprecated 
1835- @deprecated("Test") 
1836- class A: 
1837-     def __init_subclass__(self, **kwargs): 
1838-         pass 
1839- class B(A): 
1840-     pass 
1841- """ 
1842-     def  setUp (self ):
1843-         self .module  =  types .ModuleType ("testmodule" )
1844- 
1845-     def  tearDown (self ):
1846-         if  "testmodule"  in  sys .modules :
1847-             del  sys .modules ["testmodule" ]
1848- 
1849-     def  _get_help_output (self , code ):
1824+     def  test_deprecated_class (self ):
1825+         import  test .test_warnings .data .deprecated_class  as  test_module 
18501826        with  self .assertWarns (DeprecationWarning ) as  cm :
1851-             exec (code , self .module .__dict__ )
1852-             sys .modules ["testmodule" ] =  self .module 
1853- 
18541827            f  =  StringIO ()
18551828            with  redirect_stdout (f ):
1856-                 help (self . module )
1857- 
1829+                 help (test_module )
1830+              self . assertIn ( f"Help on module  { test_module . __name__ } " ,  f . getvalue ()) 
18581831        self .assertEqual (str (cm .warning ), "Test" )
1859-         return  f .getvalue ()
1860- 
1861-     def  test_help_output (self ):
1862-         for  code  in  (self .CODE_SIMPLE , self .CODE_SUBCLASS ):
1863-             with  self .subTest (code = code ):
1864-                 help_output  =  self ._get_help_output (code )
1865-                 self .assertIn ("Help on module testmodule:" , help_output )
18661832
18671833def  setUpModule ():
18681834    py_warnings .onceregistry .clear ()
0 commit comments