Sindbad~EG File Manager
�
'Μg�� � � � d Z ddlZddlZddlmZmZmZ ddlmZ G d� dej � Z
G d� dej � Zed k( r ej � yy)
z�
Test suite for PEP 380 implementation
adapted from original tests written by Greg Ewing
see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Python3.1.2-rev5.zip>
� N)�captured_stderr�
disable_gc�
gc_collect)�supportc �� � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d � Z"d!� Z#d"� Z$y#)$�TestPEP380Operationz
Test semantics.
c � ��� g ���fd�}�fd�� |� D ] }�j d|��� � | j �g d�� y)zH
Test delegation of initial next() call to subgenerator
c 3 �t �K � �j d� � � E d { ��� �j d� y 7 ��w�N�Starting g1�Finishing g1��append��g2�traces ���1/usr/local/lib/python3.12/test/test_yield_from.py�g1zOTestPEP380Operation.test_delegation_of_initial_next_to_subgenerator.<locals>.g1 s- �� �� ��L�L��'��t�O�O��L�L��(�
�� �8�6�8c 3 �Z �K � � j d� d�� � j d� y �w)N�Starting g2�* �Finishing g2r �r s �r r zOTestPEP380Operation.test_delegation_of_initial_next_to_subgenerator.<locals>.g2 s$ �� �� ��L�L��'��H��L�L��(�s �(+�Yielded )r r z
Yielded 42r r
N�r �assertEqual��selfr �xr r s @@r �/test_delegation_of_initial_next_to_subgeneratorzCTestPEP380Operation.test_delegation_of_initial_next_to_subgenerator sF �� � �� )� )� ��A��L�L��,�-� �����
� � c � ��� g ���fd�}�fd�� |� D ] }�j d|��� � | j d� | j �g d�� y# t $ r)}| j |j d d� Y d}~�Bd}~ww xY w) z?
Test raising exception in initial next() call
c 3 � �K � �j d� � � E d { ��� �j d� y 7 �# �j d� w xY w�wr r r s ��r r zKTestPEP380Operation.test_raising_exception_in_initial_next_call.<locals>.g11 s? �� �� �
-����]�+��4������^�,� �����^�,�s% �A�9 �7�9 �A�9 �A�Ac �j �� � j d� t d� �# � j d� w xY w)Nr �spanish inquisition occurredr �r �
ValueErrorr s �r r zKTestPEP380Operation.test_raising_exception_in_initial_next_call.<locals>.g27 s. �� �
-����]�+� �!?�@�@�����^�,�s � �2r �'subgenerator failed to raise ValueErrorr r&