
    <e]                     r    d dl Z d dlmZmZ  G d de j                  Zedk    r e j                     dS dS )    N)
ann_modulesupportc                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )

OpcodeTestc                     d}t          d          D ]G}||z   }ddz   n&# t          $ r Y nt          $ r Y nt          $ r Y nw xY wn#  Y nxY w	 n# w xY w||z   }H|dk    r|                     d           d S d S )Nr   
      Z   ztry inside for)range	NameErrorZeroDivisionError	TypeErrorfail)selfnis      (/usr/lib/python3.11/test/test_opcodes.pytest_try_inside_for_loopz#OpcodeTest.test_try_inside_for_loop   s    r 
	 
	A!A1"""dd$***dd"""dd"DDTTTT!AA77II&''''' 7s%   
A	A	AAA
Ac                 $   	 t          t          j        d          5 }|                                }d d d            n# 1 swxY w Y   t	          |t          j        d          }|                     |j        d           d S # t          $ r Y d S w xY w)Nzutf-8)encodingexecr	   )openr   __file__readcompileassertEqualco_firstlinenoOSError)r   ftxtcos       r   test_setup_annotations_linez&OpcodeTest.test_setup_annotations_line   s    	j)G<<< ffhh              j16::BR.22222 	 	 	DD	s1   B >B AB A9B 
BBc                 V     G d d          }|                      |j        i            d S )Nc                       e Zd ZdS )4OpcodeTest.test_default_annotations_exist.<locals>.CN__name__
__module____qualname__     r   Cr%   #             r+   r,   )r   __annotations__r   r,   s     r   test_default_annotations_existz)OpcodeTest.test_default_annotations_exist"   s2    *B/////r+   c                 z    dddii}t          d|           |                     |d         t          dd           d S )Nr.   r	      zx: int)xr	   )r   r   int)r   nss     r   test_use_existing_annotationsz(OpcodeTest.test_use_existing_annotations&   sJ    !Q(Xr-.ca0@0@AAAAAr+   c                      t          j        t                      di           5  t                      d=  G  fdd          }d d d            d S # 1 swxY w Y   d S )Nr.   c                   z    e Zd ZU [                     e          5  eed<   ddd           dS # 1 swxY w Y   dS )6OpcodeTest.test_do_not_recreate_annotations.<locals>.Cr3   N)r'   r(   r)   r.   assertRaisesr   r4   )r   s   r   r,   r9   /   s         #&&y11  FFF                 s   044r,   )r   	swap_itemglobalsr/   s   ` r    test_do_not_recreate_annotationsz+OpcodeTest.test_do_not_recreate_annotations+   s    wyy*;R@@ 	 			+,         	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                 8    G d dt                     } G d d|          } G d dt                     } G d d|          } |            #  Y nxY w |            # |$ r Y nw xY w |            # |$ r Y nw xY w |            # |$ r |                                  Y n Y nxY w |            } |            }	 |# |$ r }|                     ||           Y d }~nd }~ww xY w ||          # |$ r!}|                     ||           Y d }~d S d }~ww xY w)	Nc                       e Zd ZdS )6OpcodeTest.test_raise_class_exceptions.<locals>.AClassNr&   r*   r+   r   AClassr@   6   r-   r+   rA   c                       e Zd ZdS )6OpcodeTest.test_raise_class_exceptions.<locals>.BClassNr&   r*   r+   r   BClassrC   7   r-   r+   rD   c                       e Zd ZdS )6OpcodeTest.test_raise_class_exceptions.<locals>.CClassNr&   r*   r+   r   CClassrF   8   r-   r+   rG   c                       e Zd Zd ZdS )6OpcodeTest.test_raise_class_exceptions.<locals>.DClassc                     d S )Nr*   )r   ignores     r   __init__z?OpcodeTest.test_raise_class_exceptions.<locals>.DClass.__init__:   s    r+   N)r'   r(   r)   rL   r*   r+   r   DClassrI   9   s#            r+   rM   )	Exceptionr   r   assertIsInstance)r   rA   rD   rG   rM   abvs           r   test_raise_class_exceptionsz&OpcodeTest.test_raise_class_exceptions4   s   %%%%%Y%%%"""""V"""%%%%%Y%%%	 	 	 	 	V 	 	 	 688^688^tt688^tt688^"""tyy{{{{{FHHFHH	&G 	# 	# 	#Q""""""""	# F1IIo 	- 	- 	-!!!V,,,,,,,,,	-sr   
A A
A A&%A&)
A3 3A;:A;>
B B&#B&>C   C%C  C%(C3 3D8DDc                 F   t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d          }t          d          }|                     ||           t          d	          }t          d
          }|                     ||           d S )Nzlambda: Nonezlambda a: azlambda a=1: az	lambda: 0z	lambda: 1zlambda a: Nonezlambda b: Nonezlambda a=None: Nonezlambda a=0: Nonezlambda a=1: None)evalassertNotEqual)r   r   gs      r   test_compare_function_objectsz(OpcodeTest.test_compare_function_objects_   s       Aq!!!Aq!!!!!!!Aq!!!Aq!!!  !""Aq!!!!""!""Aq!!!!""&''Aq!!!#$$#$$Aq!!!!!r+   c                 n     G d dt                     }|                      |            dz  d           d S )Nc                       e Zd Zd ZdS )=OpcodeTest.test_modulo_of_string_subclasses.<locals>.MyStringc                     dS )N*   r*   )r   values     r   __mod__zEOpcodeTest.test_modulo_of_string_subclasses.<locals>.MyString.__mod__   s    rr+   N)r'   r(   r)   r_   r*   r+   r   MyStringr[      s#            r+   r`      r]   )strr   )r   r`   s     r    test_modulo_of_string_subclassesz+OpcodeTest.test_modulo_of_string_subclasses   sT    	 	 	 	 	s 	 	 	 	a,,,,,r+   N)r'   r(   r)   r   r"   r0   r6   r=   rS   rX   rc   r*   r+   r   r   r      s        ( ( (   0 0 0B B B
  )& )& )&V "  "  "D- - - - -r+   r   __main__)unittesttestr   r   TestCaser   r'   mainr*   r+   r   <module>ri      s     $ $ $ $ $ $ $ $- - - - -" - - -D zHMOOOOO r+   