File: //usr/local/lib/python3.7/test/__pycache__/test_generator_stop.cpython-37.pyc
B
��g� � @ s: d dl mZ d dlZG dd� dej�Zedkr6e�� dS )� )�generator_stopNc @ s e Zd Zdd� Zdd� ZdS )�
TestPEP479c s: dd� � � fdd�}| � td�� t|� � W d Q R X d S )Nc S s t �d S )N)�
StopIteration� r r �4/usr/local/lib/python3.7/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>.gzgenerator raised StopIteration)ZassertRaisesRegex�RuntimeError�next)�selfr r )r r �test_stopiteration_wrapping s
z&TestPEP479.test_stopiteration_wrappingc
s� dd� � � fdd�}yt |� � W nR tk
rt } z4| �t|j�t� | �t|j�t� | �|j� W d d }~X Y nX | � 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 ZassertIs�type� __cause__r �__context__Z
assertTrue�__suppress_context__Zfail)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 ZunittestZTestCaser r �mainr r r r �<module> s