File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_except_star.cpython-312.opt-1.pyc
�
�h�e�� � � � d dl Z d dlZd dlZd dlmZ G d� dej
� Z G d� dej
� Z G d� deej
� Z G d � d
e� Z G d� de� Z
G d
� de� Z G d� de� Z G d� de� Z
G d� de� Z G d� de� Z G d� de� Zedk( r ej$ � yy)� N)�ExceptionIsLikeMixinc �$ � e Zd Zd� Zd� Zd� Zd� Zy)�TestInvalidExceptStarc � � g d�}|D ]- }| j t � 5 t |dd� d d d � �/ y # 1 sw Y �:xY w)N)z:try: pass
except ValueError: pass
except* TypeError: pass
z:try: pass
except* ValueError: pass
except TypeError: pass
z?try: pass
except ValueError as e: pass
except* TypeError: pass
z?try: pass
except* ValueError as e: pass
except TypeError: pass
z?try: pass
except ValueError: pass
except* TypeError as e: pass
z?try: pass
except* ValueError: pass
except TypeError as e: pass
z0try: pass
except ValueError: pass
except*: pass
z0try: pass
except* ValueError: pass
except: pass
�<string>�exec)�assertRaises�SyntaxError�compile)�self�errors�errs �</opt/alt/python312/lib64/python3.12/test/test_except_star.py�1test_mixed_except_and_except_star_is_syntax_errorzGTestInvalidExceptStar.test_mixed_except_and_except_star_is_syntax_error sN � �
�� � 1�C��"�"�;�/�
1���Z��0�
1�
1� 1�
1�
1�s �8�A c � � | j t � 5 t d� �# g xt % x�}d }~nd }~� nn ��x� Y ncY w xY wd d d � y # 1 sw Y y xY w)N�blah)r � TypeError�OSError�ExceptionGroup�r �es r �7test_except_star_ExceptionGroup_is_runtime_error_singlezMTestInvalidExceptStar.test_except_star_ExceptionGroup_is_runtime_error_single sN � �
�
�
�y�
)� �
��f�o�%��
�N�
����
��� � � �s �A�#�A� A�Ac �� � | j t � 5 t dt d� g� �# g xt t f% x� n� nn ��x� Y ncY w xY wd d d � y # 1 sw Y y xY w)N�eg�* )r r r �
ValueError�r s r �6test_except_star_ExceptionGroup_is_runtime_error_tuplezLTestInvalidExceptStar.test_except_star_ExceptionGroup_is_runtime_error_tuple s] � �
�
�
�y�
)� �
�$�T�J�r�N�+;�<�<��
�Y��/�
����
��� � � �s �A�.�A�A�A%c �B � | j t � 5 t �# g xd% x� n� nn ��x� Y ncY w xY wd d d � n# 1 sw Y nxY w| j t � 5 t �# g xt df% x� n� nn ��x� Y ncY w xY wd d d � y # 1 sw Y y xY w)Nr )r r r r s r �'test_except_star_invalid_exception_typez=TestInvalidExceptStar.test_except_star_invalid_exception_type% s� � �
�
�
�y�
)� �
� � ��
�B�
����
��� � � �� �
�
�y�
)� �
� � ��
�Z��$�
����
��� � � �s6 �A��6�A�A�#B�%A+�+B �B�BN)�__name__�
__module__�__qualname__r r r r � � r r r s � �1� ��r% r c �4 � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z y) �(TestBreakContinueReturnInExceptStarBlockzC'break', 'continue' and 'return' cannot appear in an except\* blockc � � | j t | j � 5 t t j
|� dd� d d d � y # 1 sw Y y xY w)Nr r )�assertRaisesRegexr
�MSGr �textwrap�dedent)r �srcs r �
check_invalidz6TestBreakContinueReturnInExceptStarBlock.check_invalid7 s@ � �
�
#�
#�K����
:� >��H�O�O�C�(�*�f�=� >� >� >�s �!A�Ac �j � | j d� | j d� | j d� y )Nzy
try:
raise ValueError
except* Exception as e:
break
z�
for i in range(5):
try:
pass
except* Exception as e:
if i == 2:
break
z�
for i in range(5):
try:
pass
except* Exception as e:
if i == 2:
break
finally:
return 0
�r. r s r �test_break_in_except_starzBTestBreakContinueReturnInExceptStarBlock.test_break_in_except_star; s? � ����
� �
���
� �
���
�
r% c �j � | j d� | j d� | j d� y )Nz�
for i in range(5):
try:
raise ValueError
except* Exception as e:
continue
z�
for i in range(5):
try:
pass
except* Exception as e:
if i == 2:
continue
z�
for i in range(5):
try:
pass
except* Exception as e:
if i == 2:
continue
finally:
return 0
r0 r s r �*test_continue_in_except_star_block_invalidzSTestBreakContinueReturnInExceptStarBlock.test_continue_in_except_star_block_invalid[ s? � ����
� �
���
� �
���
�
r% c �H � | j d� | j d� y )Nz�
def f():
try:
raise ValueError
except* Exception as e:
return 42
z�
def f():
try:
pass
except* Exception as e:
return 42
finally:
finished = True
r0 r s r �(test_return_in_except_star_block_invalidzQTestBreakContinueReturnInExceptStarBlock.test_return_in_except_star_block_invalid{ s* � ����
� �
���
� r% c �& � t d� �# g xt % x�V}d}t d� D ] }|dk( r� |dk( r n|dz
}� | j |d� | j d� |}d }~nd }~� nn ��x� Y ncY w xY w| j t
� y )Nr r � � � � )r � Exception�range�assertEqual�assertIsInstancer )r r �count�i�excs r �.test_break_continue_in_except_star_block_validzWTestBreakContinueReturnInExceptStarBlock.test_break_continue_in_except_star_block_valid� s� � �
��R�.� �� � � ��E��1�X�
����6����6����
��
�
���U�A�&����Q��"��C��C� ���
���c�>�2s �
�A9�A
A' �#A9c �� � t d� �# g xt % x�}d� } |d� }|}d }~nd }~� nn ��x� Y ncY w xY w| j d� | j t � y )Nr c � � d| z S )N� r$ )�xs r �fzZTestBreakContinueReturnInExceptStarBlock.test_return_in_except_star_block_valid.<locals>.f� s � ���s�
r% r: � )r r; r= r>