a
    ze                     @   s:   d dl mZ d dlZG dd dejZedkr6e  dS )    )generator_stopNc                   @   s   e Zd Zdd Zdd ZdS )
TestPEP479c                    sN   dd   fdd}|  td t|  W d    n1 s@0    Y  d S )Nc                   S   s   t d S NStopIteration r   r   ./usr/lib/python3.9/test/test_generator_stop.pyf   s    z1TestPEP479.test_stopiteration_wrapping.<locals>.fc                   3   s     V  d S r   r   r   r	   r   r   g
   s    z1TestPEP479.test_stopiteration_wrapping.<locals>.gzgenerator raised StopIteration)ZassertRaisesRegexRuntimeErrornext)selfr   r   r
   r   test_stopiteration_wrapping   s    z&TestPEP479.test_stopiteration_wrappingc              
      s   dd   fdd}zt |  W nT tyv } z<| t|jt | t|jt | |j W Y d }~nd }~0 0 | 	d d S )Nc                   S   s   t d S r   r   r   r   r   r   r	      s    z9TestPEP479.test_stopiteration_wrapping_context.<locals>.fc                   3   s     V  d S r   r   r   r
   r   r   r      s    z9TestPEP479.test_stopiteration_wrapping_context.<locals>.gzE__cause__, __context__, or __suppress_context__ were not properly set)
r   r   ZassertIstype	__cause__r   __context__Z
assertTrue__suppress_context__Zfail)r   r   excr   r
   r   #test_stopiteration_wrapping_context   s    "z.TestPEP479.test_stopiteration_wrapping_contextN)__name__
__module____qualname__r   r   r   r   r   r   r      s   	r   __main__)Z
__future__r   ZunittestZTestCaser   r   mainr   r   r   r   <module>   s   