
    daf%                         d dl Z d dlmZ  G d de j                        Z G d de j                        Zej                   G d de j                               Zed	k(  r e j                          yy)
    N)supportc                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestMROEntryc                     g  G d d      } G fdd              }| j                  g         G d d||      }| j                  d   ||ff       | j                  d   i        y )	Nc                       e Zd Zy)0TestMROEntry.test_mro_entry_signature.<locals>.BN__name__
__module____qualname__     1/root/Python-3.12.4/Lib/test/test_genericclass.pyBr          r   r   c                       e Zd Z fdZy)0TestMROEntry.test_mro_entry_signature.<locals>.Cc                 0    j                  ||g       fS Nextend)selfargskwargsCtesteds      r   __mro_entries__z@TestMROEntry.test_mro_entry_signature.<locals>.C.__mro_entries__
   s    tVn-tr   Nr
   r   r   r   r   r   s   r   r   r   	       r   r   c                       e Zd Zy)0TestMROEntry.test_mro_entry_signature.<locals>.DNr	   r   r   r   Dr"      r   r   r#   r      )assertEqual)r   r   cr#   r   r   s       @@r   test_mro_entry_signaturez%TestMROEntry.test_mro_entry_signature   sh    	 	 C$1aVI.B'r   c                    g  G d d      } G d d      } G fdd      } |       }| j                  g         G d d|||      }| j                  d	   |||f       | j                  |j                  |||f       | j                  |j                  |||f       | j                  |j                  ||||t        f        |       } G d
 d|      }| j                  d	   |f       | j                  |j                  |f       y )Nc                       e Zd Zy)&TestMROEntry.test_mro_entry.<locals>.ANr	   r   r   r   Ar*      r   r   r+   c                       e Zd Zy)&TestMROEntry.test_mro_entry.<locals>.BNr	   r   r   r   r   r-      r   r   r   c                       e Zd Z fdZy)&TestMROEntry.test_mro_entry.<locals>.Cc                 @    j                  |       | j                  fS r   )append	__class__r   basesr   s     r   r   z6TestMROEntry.test_mro_entry.<locals>.C.__mro_entries__   s    e$((r   Nr   r   s   r   r   r/      s    )r   r   c                       e Zd Zy)&TestMROEntry.test_mro_entry.<locals>.DNr	   r   r   r   r#   r7      r   r   r#   c                       e Zd Zy)&TestMROEntry.test_mro_entry.<locals>.ENr	   r   r   r   Er:   #   r   r   r;   r%   	__bases____orig_bases____mro__object)	r   r+   r   r   r&   r#   dr;   r   s	           @r   test_mro_entryzTestMROEntry.test_mro_entry   s    	) 	) C$1aaAY/q!Qi0))Aq!95Q1a$89CaT*qd+r   c                    g  G d d      } G d d      } G fdd      } |       }| j                  g         G d d|||      }| j                  d	   |||f       | j                  |j                  ||f       | j                  |j                  |||f       | j                  |j                  |||t        f        G d
 d|      }| j                  d	   |f       | j                  |j                  t        f       | j                  |j                  |f       | j                  |j                  |t        f       y )Nc                       e Zd Zy)+TestMROEntry.test_mro_entry_none.<locals>.ANr	   r   r   r   r+   rE   )   r   r   r+   c                       e Zd Zy)+TestMROEntry.test_mro_entry_none.<locals>.BNr	   r   r   r   r   rG   *   r   r   r   c                       e Zd Z fdZy)+TestMROEntry.test_mro_entry_none.<locals>.Cc                 (    j                  |       yNr   r1   r3   s     r   r   z;TestMROEntry.test_mro_entry_none.<locals>.C.__mro_entries__,   s    e$r   Nr   r5   s   r   r   rI   +   s    r   r   c                       e Zd Zy)+TestMROEntry.test_mro_entry_none.<locals>.DNr	   r   r   r   r#   rN   1   r   r   r#   r8   c                       e Zd Zy)+TestMROEntry.test_mro_entry_none.<locals>.ENr	   r   r   r   r;   rP   6   r   r   r;   r<   )r   r+   r   r   r&   r#   r;   r   s          @r   test_mro_entry_nonez TestMROEntry.test_mro_entry_none'   s   	 	 C$1aaAY/q!f-))Aq!95Q1f$56aT*vi0))A40QK0r   c                 ~   g  G d d      } G fdd      } |       }| j                  g         G d d||      }| j                  d   ||f       | j                  |j                  |t        f       | j                  |j                  ||f       | j                  |j                  ||t        t
        f       y )Nc                       e Zd Zy)4TestMROEntry.test_mro_entry_with_builtins.<locals>.ANr	   r   r   r   r+   rT   >   r   r   r+   c                       e Zd Z fdZy)4TestMROEntry.test_mro_entry_with_builtins.<locals>.Cc                 4    j                  |       t        fS r   )r1   dictr3   s     r   r   zDTestMROEntry.test_mro_entry_with_builtins.<locals>.C.__mro_entries__@   s    e$wr   Nr   r5   s   r   r   rV   ?   s    r   r   c                       e Zd Zy)4TestMROEntry.test_mro_entry_with_builtins.<locals>.DNr	   r   r   r   r#   rZ   E   r   r   r#   r8   )r%   r=   rX   r>   r?   r@   )r   r+   r   r&   r#   r   s        @r   test_mro_entry_with_builtinsz)TestMROEntry.test_mro_entry_with_builtins<   s    	 	 C$1aV,q$i0))Aq62Q4$89r   c                    g  G fdd              }| j                  g         G d d|t              }| j                  d   |t        f       | j                  |j                  t        f       | j                  |j                  |t        f       | j                  |j                  |t        t
        f       y )Nc                       e Zd Z fdZy)6TestMROEntry.test_mro_entry_with_builtins_2.<locals>.Cc                 ,    j                  |       fS r   rL   )r   r4   r   r   s     r   r   zFTestMROEntry.test_mro_entry_with_builtins_2.<locals>.C.__mro_entries__N   s    e$tr   Nr   r   s   r   r   r^   M   r    r   r   c                       e Zd Zy)6TestMROEntry.test_mro_entry_with_builtins_2.<locals>.DNr	   r   r   r   r#   ra   S   r   r   r#   r8   )r%   rX   r=   r>   r?   r@   )r   r&   r#   r   r   s      @@r   test_mro_entry_with_builtins_2z+TestMROEntry.test_mro_entry_with_builtins_2K   s    	 	 C$4aY/q$i0))At95Q4$89r   c                     G d d      } |       }| j                  t              5   G d d|      }d d d         G d d      } |       }| j                  t              5   G d d|      }d d d        y # 1 sw Y   DxY w# 1 sw Y   y xY w)	Nc                       e Zd Zd Zy)6TestMROEntry.test_mro_entry_errors.<locals>.C_too_manyc                      yrK   r   )r   r4   	somethingothers       r   r   zFTestMROEntry.test_mro_entry_errors.<locals>.C_too_many.__mro_entries__[       r   Nr   r   r   r   
C_too_manyre   Z       r   rj   c                       e Zd Zy)-TestMROEntry.test_mro_entry_errors.<locals>.DNr	   r   r   r   r#   rm   _   r   r   r#   c                       e Zd Zd Zy)5TestMROEntry.test_mro_entry_errors.<locals>.C_too_fewc                      yrK   r   r   s    r   r   zETestMROEntry.test_mro_entry_errors.<locals>.C_too_few.__mro_entries__a   ri   r   Nr   r   r   r   	C_too_fewro   `   rk   r   rr   c                       e Zd Zy)-TestMROEntry.test_mro_entry_errors.<locals>.ENr	   r   r   r   r;   rt   e   r   r   r;   assertRaises	TypeError)r   rj   r&   r#   rr   rA   r;   s          r   test_mro_entry_errorsz"TestMROEntry.test_mro_entry_errorsY   s    	 	 Ly) 	AO		 	 Ky) 	AO	 		 		 	   A6!B6A?Bc                     G d d      } |       }| j                  t              5   G d d|      }d d d         G d d      } |       }| j                  t              5   G d d|      }d d d        y # 1 sw Y   DxY w# 1 sw Y   y xY w)	Nc                       e Zd ZdZy)<TestMROEntry.test_mro_entry_errors_2.<locals>.C_not_callable	Surprise!Nr   r   r   r   C_not_callabler|   h   s    )Or   r~   c                       e Zd Zy)/TestMROEntry.test_mro_entry_errors_2.<locals>.DNr	   r   r   r   r#   r   l   r   r   r#   c                       e Zd Zd Zy)9TestMROEntry.test_mro_entry_errors_2.<locals>.C_not_tuplec                     t         S r   )r@   rq   s    r   r   zITestMROEntry.test_mro_entry_errors_2.<locals>.C_not_tuple.__mro_entries__n   s    r   Nr   r   r   r   C_not_tupler   m   s    r   r   c                       e Zd Zy)/TestMROEntry.test_mro_entry_errors_2.<locals>.ENr	   r   r   r   r;   r   r   r   r   r;   ru   )r   r~   r&   r#   r   r;   s         r   test_mro_entry_errors_2z$TestMROEntry.test_mro_entry_errors_2g   s    	* 	*y) 	AO		 	 My) 	AO	 		 		 	ry   c                 $   g  G fddt               } G d d       G fdd      } |       } G d d||	      }| j                  d
   |       | j                  d   d       | j                  d   f       | j                  d   d   d       | j                  |j                  f       | j                  |j                  |f       | j                  |j                  |t
        f       | j                  |j                  |       y )Nc                   "     e Zd Z fdZ xZS )3TestMROEntry.test_mro_entry_metaclass.<locals>.Metac                 R    j                  | |||g       t        | 	  | |||      S r   )r   super__new__)mclsnamer4   nsr2   	meta_argss       r   r   z;TestMROEntry.test_mro_entry_metaclass.<locals>.Meta.__new__w   s/      $eR!89wtT5"==r   )r
   r   r   r   __classcell__)r2   r   s   @r   Metar   v   s    > >r   r   c                       e Zd Zy)0TestMROEntry.test_mro_entry_metaclass.<locals>.ANr	   r   r   r   r+   r   z   r   r   r+   c                       e Zd Z fdZy)0TestMROEntry.test_mro_entry_metaclass.<locals>.Cc                 
    fS r   r   )r   r4   r+   s     r   r   z@TestMROEntry.test_mro_entry_metaclass.<locals>.C.__mro_entries__|   s
    tr   Nr   )r+   s   r   r   r   {   s    r   r   c                       e Zd ZdZy)0TestMROEntry.test_mro_entry_metaclass.<locals>.Dr$   N)r
   r   r   xr   r   r   r#   r      s    Ar   r#   	metaclassr   r$         r   )typer%   r=   r>   r?   r@   r2   )r   r   r   r&   r#   r+   r   s        @@r   test_mro_entry_metaclassz%TestMROEntry.test_mro_entry_metaclasst   s    		>4 	> 		 	 C	T 	1t,1s+1t,1c*A.qd+))A40Q6N3d+r   c                      G d d      } |       }| j                  t        d      5  t        d|fi        d d d        y # 1 sw Y   y xY w)Nc                       e Zd Zd Zy)0TestMROEntry.test_mro_entry_type_call.<locals>.Cc                      yrK   r   )r   r4   s     r   r   z@TestMROEntry.test_mro_entry_type_call.<locals>.C.__mro_entries__   ri   r   Nr   r   r   r   r   r      rk   r   r   z+MRO entry resolution; use types.new_class()Bad)assertRaisesRegexrw   r   )r   r   r&   s      r   test_mro_entry_type_callz%TestMROEntry.test_mro_entry_type_call   sO    	 	 C##I%<= 	" b!	" 	" 	"s   A  A	N)r
   r   r   r'   rB   rQ   r[   rb   rx   r   r   r   r   r   r   r   r      s/    (,(1*::,,	"r   r   c                   T    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)TestClassGetitemc                     g  G fdd      }|t         t        f    | j                  d   |t         t        ff       | j                  d   i        y )Nc                       e Zd Z fdZy).TestClassGetitem.test_class_getitem.<locals>.Cc                  ,    j                  | |g       y r   r   )r   r   getitem_argss     r   __class_getitem__z@TestClassGetitem.test_class_getitem.<locals>.C.__class_getitem__   s    ##T6N3r   Nr
   r   r   r   )r   s   r   r   r      s    r   r   r   r$   )intstrr%   )r   r   r   s     @r   test_class_getitemz#TestClassGetitem.test_class_getitem   sO    	 	 	
#s(a1sCj/:a"-r   c                 t     G d d      }| j                  |t           d       | j                  ||   d       y )Nc                       e Zd Zd Zy)5TestClassGetitem.test_class_getitem_format.<locals>.Cc                 "    d|j                    dS )NzC[]r
   clsitems     r   r   zGTestClassGetitem.test_class_getitem_format.<locals>.C.__class_getitem__   s    DMM?!,,r   Nr   r   r   r   r   r          -r   r   C[int]zC[C]r%   r   )r   r   s     r   test_class_getitem_formatz*TestClassGetitem.test_class_getitem_format   s6    	- 	- 	3*1v&r   c                      G d d      } G d d|      }| j                  |t           d       | j                  ||   d       y )Nc                       e Zd Zd Zy):TestClassGetitem.test_class_getitem_inheritance.<locals>.Cc                 :    | j                    d|j                    dS N[r   r   r   s     r   r   zLTestClassGetitem.test_class_getitem_inheritance.<locals>.C.__class_getitem__       ,,qq99r   Nr   r   r   r   r   r          :r   r   c                       e Zd Zy):TestClassGetitem.test_class_getitem_inheritance.<locals>.DNr	   r   r   r   r#   r      r   r   r#   D[int]D[D]r   r   r   r#   s      r   test_class_getitem_inheritancez/TestClassGetitem.test_class_getitem_inheritance   s=    	: 	: 	3*1v&r   c                      G d d      } G d d|      }| j                  |t           d       | j                  ||   d       y )Nc                       e Zd Zd Zy)<TestClassGetitem.test_class_getitem_inheritance_2.<locals>.Cc                      y)NzShould not see thisr   r   s     r   r   zNTestClassGetitem.test_class_getitem_inheritance_2.<locals>.C.__class_getitem__   s    ,r   Nr   r   r   r   r   r      r   r   r   c                       e Zd Zd Zy)<TestClassGetitem.test_class_getitem_inheritance_2.<locals>.Dc                 :    | j                    d|j                    dS r   r   r   s     r   r   zNTestClassGetitem.test_class_getitem_inheritance_2.<locals>.D.__class_getitem__   r   r   Nr   r   r   r   r#   r      r   r   r#   r   r   r   r   s      r    test_class_getitem_inheritance_2z1TestClassGetitem.test_class_getitem_inheritance_2   sB    	- 	-	: 	: 	3*1v&r   c                      G d d      } G d d|      }| j                  |t           d       | j                  ||   d       y )Nc                       e Zd Zed        Zy):TestClassGetitem.test_class_getitem_classmethod.<locals>.Cc                 :    | j                    d|j                    dS r   r   r   s     r   r   zLTestClassGetitem.test_class_getitem_classmethod.<locals>.C.__class_getitem__   s    ,,qq99r   N)r
   r   r   classmethodr   r   r   r   r   r      s    : :r   r   c                       e Zd Zy):TestClassGetitem.test_class_getitem_classmethod.<locals>.DNr	   r   r   r   r#   r      r   r   r#   r   r   r   r   s      r   test_class_getitem_classmethodz/TestClassGetitem.test_class_getitem_classmethod   s=    	: 	: 	3*1v&r   c                      G d d      } G d d|      }| j                  |t           d       | j                  ||   d       y )Nc                       e Zd Zd Zy)6TestClassGetitem.test_class_getitem_patched.<locals>.Cc                 *    d }t        |      | _        y )Nc                 :    | j                    d|j                    dS r   r   r   s     r   r   zcTestClassGetitem.test_class_getitem_patched.<locals>.C.__init_subclass__.<locals>.__class_getitem__   s    !ll^1T]]O1==r   )r   r   )r   r   s     r   __init_subclass__zHTestClassGetitem.test_class_getitem_patched.<locals>.C.__init_subclass__   s    >(34E(F%r   N)r
   r   r   r   r   r   r   r   r      s    Gr   r   c                       e Zd Zy)6TestClassGetitem.test_class_getitem_patched.<locals>.DNr	   r   r   r   r#   r      r   r   r#   r   r   r   r   s      r   test_class_getitem_patchedz+TestClassGetitem.test_class_getitem_patched   s?    	G 	G
 	3*1v&r   c                      G d dt               } G d d|      }| j                  |j                  d        |t            | j                  |j                  t               y )Nc                       e Zd ZdZd Zy)<TestClassGetitem.test_class_getitem_with_builtins.<locals>.ANc                     || _         y r   )called_withr   s     r   r   zNTestClassGetitem.test_class_getitem_with_builtins.<locals>.A.__class_getitem__   s	    "&r   )r
   r   r   r   r   r   r   r   r+   r      s    K'r   r+   c                       e Zd Zy)<TestClassGetitem.test_class_getitem_with_builtins.<locals>.BNr	   r   r   r   r   r          r   r   )rX   assertIsr   r   )r   r+   r   s      r    test_class_getitem_with_builtinsz1TestClassGetitem.test_class_getitem_with_builtins   sE    	' 	'
	 	ammT*	#ammS)r   c                      G d d      }| j                  t              5  |t            d d d         G d d      }| j                  t              5  |t            d d d        y # 1 sw Y   ;xY w# 1 sw Y   y xY w)Nc                       e Zd Zd Zy)=TestClassGetitem.test_class_getitem_errors.<locals>.C_too_fewc                      y r   r   )r   s    r   r   zOTestClassGetitem.test_class_getitem_errors.<locals>.C_too_few.__class_getitem__       r   Nr   r   r   r   rr   r          r   rr   c                       e Zd Zd Zy)>TestClassGetitem.test_class_getitem_errors.<locals>.C_too_manyc                      y r   r   )r   onetwos      r   r   zPTestClassGetitem.test_class_getitem_errors.<locals>.C_too_many.__class_getitem__   r   r   Nr   r   r   r   rj   r      r   r   rj   )rv   rw   r   )r   rr   rj   s      r   test_class_getitem_errorsz*TestClassGetitem.test_class_getitem_errors   ss    	 	 y) 	cN		 	 y) 	sO	 		 		 	s   
A$
A0$A-0A9c                      G d d      }| j                  t              5   |       t            d d d         G d d      } |       }d |_        | j                  t              5  |t            d d d         G d d      }| j                  t              5  |t            d d d         G d d	t              }| j                  t        d	      5  |t            d d d        y # 1 sw Y   xY w# 1 sw Y   ~xY w# 1 sw Y   YxY w# 1 sw Y   y xY w)
Nc                       e Zd Zd Zy)7TestClassGetitem.test_class_getitem_errors_2.<locals>.Cc                      y r   r   r   s     r   r   zITestClassGetitem.test_class_getitem_errors_2.<locals>.C.__class_getitem__   r   r   Nr   r   r   r   r   r     r   r   r   c                       e Zd Zy)7TestClassGetitem.test_class_getitem_errors_2.<locals>.ENr	   r   r   r   r;   r     r   r   r;   c                      y)NzThis will not workr   r   s     r   <lambda>z>TestClassGetitem.test_class_getitem_errors_2.<locals>.<lambda>   s    r   c                       e Zd ZdZy)DTestClassGetitem.test_class_getitem_errors_2.<locals>.C_not_callabler}   Nr   r   r   r   r~   r     s     +r   r~   c                       e Zd ZdZy)?TestClassGetitem.test_class_getitem_errors_2.<locals>.C_is_noneNr   r   r   r   	C_is_noner
     s     $r   r  )rv   rw   r   r   tupler   )r   r   r;   er~   r  s         r   test_class_getitem_errors_2z,TestClassGetitem.test_class_getitem_errors_2   s    	 	 y) 	CH	 	CDy) 	cF		, 	,y) 	 3	 	% 	%##I{; 	cN	 	!	 		 	
	  	 
	 	s/   C %
C,
C8
D C),C58DDc                 T     G d dt               }| j                  |t           d       y )Nc                       e Zd Zd Zy);TestClassGetitem.test_class_getitem_metaclass.<locals>.Metac                 :    | j                    d|j                    dS r   r   r   s     r   r   zMTestClassGetitem.test_class_getitem_metaclass.<locals>.Meta.__class_getitem__   r   r   Nr   r   r   r   r   r     r   r   r   z	Meta[int]r   r%   r   )r   r   s     r   test_class_getitem_metaclassz-TestClassGetitem.test_class_getitem_metaclass   s$    	:4 	: 	cK0r   c                 l     G d dt               } G d d|      }| j                  |t           d       y )Nc                       e Zd Zy)@TestClassGetitem.test_class_getitem_with_metaclass.<locals>.MetaNr	   r   r   r   r   r    r   r   r   c                       e Zd Zd Zy)=TestClassGetitem.test_class_getitem_with_metaclass.<locals>.Cc                 :    | j                    d|j                    dS r   r   r   s     r   r   zOTestClassGetitem.test_class_getitem_with_metaclass.<locals>.C.__class_getitem__  r   r   Nr   r   r   r   r   r    r   r   r   r   r   r  r   r   r   s      r   !test_class_getitem_with_metaclassz2TestClassGetitem.test_class_getitem_with_metaclass  s,    4	:$ 	: 	3*r   c                 l     G d dt               } G d d|      }| j                  |t           d       y )Nc                       e Zd Zd Zy)ATestClassGetitem.test_class_getitem_metaclass_first.<locals>.Metac                      y)Nfrom metaclassr   r   s     r   __getitem__zMTestClassGetitem.test_class_getitem_metaclass_first.<locals>.Meta.__getitem__  s    'r   N)r
   r   r   r"  r   r   r   r   r    s    (r   r   c                       e Zd Zd Zy)>TestClassGetitem.test_class_getitem_metaclass_first.<locals>.Cc                      y)Nzfrom __class_getitem__r   r   s     r   r   zPTestClassGetitem.test_class_getitem_metaclass_first.<locals>.C.__class_getitem__  s    /r   Nr   r   r   r   r   r$    s    0r   r   r   r!  r  r  s      r   "test_class_getitem_metaclass_firstz3TestClassGetitem.test_class_getitem_metaclass_first
  s1    	(4 	(	0$ 	0 	3!12r   N)r
   r   r   r   r   r   r   r   r   r   r   r  r  r  r&  r   r   r   r   r      s>    .'''''
*.1+3r   r   c                       e Zd Zd Zy)CAPITestc                    ddl m}m} | j                  |j	                  t
              |       |t
           }| j                  t        |      |       | j                  |j                  d      t
        f        G d d|      }| j                  |j                  t
        f       | j                  |j                  |f       | j                  |j                  |t
        t        f       y )Nr   )GenericGenericAliasr   c                       e Zd Zy) CAPITest.test_c_class.<locals>.CNr	   r   r   r   r   r-    r   r   r   )	_testcapir*  r+  assertIsInstancer   r   r   r   r%   r   r=   r>   r?   r@   )r   r*  r+  
IntGenericr   s        r   test_c_classzCAPITest.test_c_class  s    3g77<lKS\
d:&533B7#@	
 	sf-))J=9QV$45r   N)r
   r   r   r1  r   r   r   r(  r(    s    6r   r(  __main__)
unittesttestr   TestCaser   r   cpython_onlyr(  r
   mainr   r   r   <module>r8     sv     N"8$$ N"b{3x(( {3| 	6x   6 6  zHMMO r   