@@ -325,18 +325,40 @@ def test3(self):
325
325
self .assertIn ('It is deprecated to return a value that is not None' , str (w .warning ))
326
326
self .assertIn ('test1' , str (w .warning ))
327
327
self .assertEqual (w .filename , __file__ )
328
+ self .assertIn ("(<class 'int'>)" , str (w .warning ))
328
329
329
330
with self .assertWarns (DeprecationWarning ) as w :
330
331
Foo ('test2' ).run ()
331
332
self .assertIn ('It is deprecated to return a value that is not None' , str (w .warning ))
332
333
self .assertIn ('test2' , str (w .warning ))
333
334
self .assertEqual (w .filename , __file__ )
335
+ self .assertIn ("(<class 'generator'>)" , str (w .warning ))
334
336
335
337
with self .assertWarns (DeprecationWarning ) as w :
336
338
Foo ('test3' ).run ()
337
339
self .assertIn ('It is deprecated to return a value that is not None' , str (w .warning ))
338
340
self .assertIn ('test3' , str (w .warning ))
339
341
self .assertEqual (w .filename , __file__ )
342
+ self .assertIn (f'({ Nothing } )' , str (w .warning ))
343
+
344
+ def test_deprecation_of_return_val_from_test_async_method (self ):
345
+ class Foo (unittest .TestCase ):
346
+ async def test1 (self ):
347
+ return 1
348
+
349
+ with self .assertWarns (DeprecationWarning ) as w :
350
+ Foo ('test1' ).run ()
351
+ self .assertIn ('It is deprecated to return a value that is not None' , str (w .warning ))
352
+ self .assertIn ('test1' , str (w .warning ))
353
+ self .assertEqual (w .filename , __file__ )
354
+ self .assertIn ("(<class 'coroutine'>)" , str (w .warning ))
355
+ self .assertIn (
356
+ (
357
+ "a coroutine is returned, "
358
+ "maybe you forgot to use IsolatedAsyncioTestCase base class?"
359
+ ),
360
+ str (w .warning ),
361
+ )
340
362
341
363
def _check_call_order__subtests (self , result , events , expected_events ):
342
364
class Foo (Test .LoggingTestCase ):
0 commit comments