B
    18\                 @   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          	      s:   dd   fdd}|  td t|  W d Q R X d S )Nc               S   s   t d S )N)StopIteration r   r   \/oak/stanford/groups/akundaje/marinovg/programs/Python-3.7.3/Lib/test/test_generator_stop.pyf   s    z1TestPEP479.test_stopiteration_wrapping.<locals>.fc               3   s     V  d S )Nr   r   )r   r   r   g
   s    z1TestPEP479.test_stopiteration_wrapping.<locals>.gzgenerator raised StopIteration)assertRaisesRegexRuntimeErrornext)selfr   r   )r   r   test_stopiteration_wrapping   s
    z&TestPEP479.test_stopiteration_wrappingc          
      s   dd   fdd}yt |  W nR tk
rt } z4| t|jt | t|jt | |j W d d }~X Y nX | 	d d S )Nc               S   s   t d S )N)r   r   r   r   r   r      s    z9TestPEP479.test_stopiteration_wrapping_context.<locals>.fc               3   s     V  d S )Nr   r   )r   r   r   r      s    z9TestPEP479.test_stopiteration_wrapping_context.<locals>.gzE__cause__, __context__, or __suppress_context__ were not properly set)
r   r
   assertIstype	__cause__r   __context__
assertTrue__suppress_context__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   unittestTestCaser   r   mainr   r   r   r   <module>   s   