o
    HXh                     @   s>   d dl mZ d dlZG dd dejZedkre  dS dS )    )generator_stopNc                   @   s   e Zd Zdd Zdd ZdS )
TestPEP479c                    sP   dd   fdd}|  td t|  W d    d S 1 s!w   Y  d S )Nc                   S      t NStopIteration r   r   B/opt/python-3.10.19/usr/lib/python3.10/test/test_generator_stop.pyf      z1TestPEP479.test_stopiteration_wrapping.<locals>.fc                   3         V  d S r   r   r   r
   r   r	   g
      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 n+ ty< } z| t|jt | t|jt | |j W Y d }~d S d }~ww | 	d d S )Nc                   S   r   r   r   r   r   r   r	   r
      r   z9TestPEP479.test_stopiteration_wrapping_context.<locals>.fc                   3   r   r   r   r   r   r   r	   r      r   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    