mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	gh-110378: Fix test_async_gen_propagates_generator_exit in test_contextlib_async (#110500)
It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code.
This commit is contained in:
		
							parent
							
								
									fc811c8d20
								
							
						
					
					
						commit
						5aa62a8de1
					
				
					 1 changed files with 5 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -49,15 +49,11 @@ async def gen():
 | 
			
		|||
            async with ctx():
 | 
			
		||||
                yield 11
 | 
			
		||||
 | 
			
		||||
        ret = []
 | 
			
		||||
        exc = ValueError(22)
 | 
			
		||||
        with self.assertRaises(ValueError):
 | 
			
		||||
            async with ctx():
 | 
			
		||||
                async for val in gen():
 | 
			
		||||
                    ret.append(val)
 | 
			
		||||
                    raise exc
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(ret, [11])
 | 
			
		||||
        g = gen()
 | 
			
		||||
        async for val in g:
 | 
			
		||||
            self.assertEqual(val, 11)
 | 
			
		||||
            break
 | 
			
		||||
        await g.aclose()
 | 
			
		||||
 | 
			
		||||
    def test_exit_is_abstract(self):
 | 
			
		||||
        class MissingAexit(AbstractAsyncContextManager):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue