
    dafI;                         d dl Zd dlZd dlZd dlZd dlZd dlmZ  G d dej                        Z	e
dk(  r ej                          yy)    N)C_RECURSION_LIMITc                   l    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d Zd Zd Zd Zy)DictSetTestc                    t        i j                               }| j                  t        |i        | j                  t        |       t        i j	                               }| j                  t        |i        | j                  t        |       t        i j                               }| j                  t        |i        | j                  t        |       y N)typekeysassertRaises	TypeErroritemsvalues)selfktitvts       ./root/Python-3.12.4/Lib/test/test_dictviews.pytest_constructors_not_callablez*DictSetTest.test_constructors_not_callable
   s    "'')_)R,)R("((*)R,)R("))+)R,)R(    c                    ddd}|j                         }| j                  t        |      d       | j                  t        |      ddh       | j                  |ddh       | j	                  |h d       | j	                  |ddh       | j	                  |dh       | j	                  |d	       | j                  d|       | j                  d|       | j                  d|       | j                  d
|       | j                  |j                         |j                                ddd}| j                  |j                         |j                                |d= | j	                  |j                         |j                                y )N
   ABC   a   r   r   >   r   br   r   *   Z   def)r	   assertEquallensetassertNotEqualassertInassertNotIn)r   dr	   es       r   test_dict_keyszDictSetTest.test_dict_keys   s>   vvxTA&TQH-3x(D-0D1c(+D1#&D"%ac4 T"d#1668,1668,cFAFFHaffh/r   c                    ddd}|j                         }| j                  t        |      d       | j                  t        |      ddh       | j                  |ddh       | j	                  |h d       | j	                  |ddh       | j	                  |dh       | j	                  |d	       | j                  d|       | j                  d|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  |j                         |j                                |j                         }| j                  |j                         |j                                d|d<   | j	                  |j                         |j                                y )Nr   r   r   r   r   r   r   r   >   r,   r+   junk)r   r    r   )r   r   r    )r   )r   r      r    r   )r   r!   r"   r#   r$   r%   r&   copy)r   r'   r   r(   s       r   test_dict_itemszDictSetTest.test_dict_items)   su   	UQ'Ug|%<=, 78E#BCEG\#:;EG9-E2&gu%lE*%(E"U#u%E*AGGI.FFHAGGI.#AGGIqwwy1r   c                     ddd}ddd}| j                  |j                         |j                                | j                  |j                         |j                                y )Nr      ))r   r   )r   r   r   r   r   r   )r!   r	   r   r$   )r   r'   r(   s      r   test_dict_mixed_keys_itemsz&DictSetTest.test_dict_mixed_keys_items@   sM    $aL1779-AGGIqvvx0r   c                     ddd}|j                         }| j                  t        |      ddh       | j                  t        |      d       y )Nr   r   r   r   )r   r!   r#   r"   )r   r'   r   s      r   test_dict_valueszDictSetTest.test_dict_valuesF   sC    Vr5k2Va(r   c                    ddd}| j                  t        |      t               t        |j                               }| j                  |t               | j	                  |dk(  xs |dk(         t        |j                               }| j                  |t               | j	                  |dk(  xs |dk(         t        |j                               }| j                  |t               | j	                  |dk(  xs |d	k(         y )
Nr   r   r   z#dict_items([('a', 'ABC'), (1, 10)])z#dict_items([(1, 10), ('a', 'ABC')])zdict_keys(['a', 1])zdict_keys([1, 'a'])zdict_values(['ABC', 10])zdict_values([10, 'ABC']))assertIsInstancereprstrr   
assertTruer	   r   r   r'   rs      r   test_dict_reprzDictSetTest.test_dict_reprL   s    d1gs+Oa%BB CBB	DNa%22 322	4a%77 877	9r   c           	      v   ddd}ddd}ddd}d	di} G fd
dt               | j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  dh       | j                  |j                         |j                         z  t                      | j                  |j                         t        |j                               z  ddh       | j                  |j                         t        |j                               z  dh       | j                  |j                         t        |j                               z  t                      | j                  |j                         t        |j                               z  ddh       | j                  |j                         |j                         z  d	h       | j                  |j                         |j                         z  d	h       | j                  |j                         t        |j                               z  d	h       | j	                  |j                         t        |j                               z  t                | j	                  t        |j                               |j                         z  t                | j                  t        |j                          |j                               z        t                | j                  t        |j                         g z        t                | j                  t        g |j                         z        t                | j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  h d       | j                  |j                         |j                         z  h d       | j                  |j                         t        |j                               z  ddh       | j                  |j                         t        |j                               z  h d       | j                  |j                         t        |j                               z  h d       | j                  |j                         dz  h d       | j                  |j                         |j                         z  t                      | j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  h d       | j                  |j                         t        |j                               z  t                      | j                  |j                         t        |j                               z  ddh       | j                  |j                         t        |j                               z  h d       | j                  |j                         t        |j                               z  ddh       | j                  |j                         |j                         z
  t                      | j                  |j                         |j                         z
  dh       | j                  |j                         |j                         z
  ddh       | j                  |j                         t        |j                               z
  t                      | j                  |j                         t        |j                               z
  dh       | j                  |j                         t        |j                               z
  ddh       | j                  |j                         dz
  ddh       | j                  |j                         j                  |j                                      | j                  |j                         j                  |j                                      | j                  |j                         j                  t        |j                                            | j                  |j                         j                  t        |j                                            | j                  |j                         j                  h d             | j                  |j                         j                  g d             | j                  |j                         j                  t        g d                   | j                  |j                         j                  t        ddg                   | j                  |j                         j                  ddg             | j                  |j                         j                  i              | j                  |j                         j                  |j                                      i }| j                  |j                         j                  t                            | j                  |j                         j                  g              | j                  |j                         j                  |j                                      | j                  |j                         j                  dg             y )Nr   r   r   r   r/   )r   c      r'   r(   r'   c                   "     e Zd Z fdZ xZS )7DictSetTest.test_keys_set_operations.<locals>.CustomSetc                 .     t         |   |            S r   )superintersection)r   other	CustomSet	__class__s     r   rJ   zDDictSetTest.test_keys_set_operations.<locals>.CustomSet.intersectionc   s     !5e!<==r   )__name__
__module____qualname__rJ   __classcell__)rM   rL   s   @r   rL   rG   b   s    > >r   rL   r   r   >   r   r   rB   >   r   r   r'   r(   r4   >   r   r   r   r   rB   )r   r   >   xyzrR   rS   rT   rR   rS   )r#   r!   r	   tupler9   	frozensetassertIsr   assertFalse
isdisjointlistr<   )r   d1d2d3d4derL   s         @r   test_keys_set_operationsz$DictSetTest.test_keys_set_operations\   sh   1111X	> 	> 	RWWY.c
;RWWY.6RWWY.6S^3c3Z@S^3cU;S^3SU;U2779%55SzBRWWY.6RWWY.6S^3cU;bggi)BGGI*>>Di	2RWWY>Dd2779y';;<cBd2779r>*C0d2	>*C0RWWY.c
;RWWY.@RWWY.0DES^3c3Z@S^3_ES^3-	/V+-=>RWWY.6RWWY.c
;RWWY.0DES^3SU;S^3c3Z@S^3-	/U2779%55SzBRWWY.6RWWY.6RWWY.c
;S^3SU;S^3cU;S^3c3Z@V+c3Z8--bggi89--bggi89--d2779o>?--c"'')n=>	,,_=>	,,_=>	,,S-ABC	,,S#s_=>	,,c3Z89	,,R01	,,RWWY78	,,SU34	,,R01	,,RWWY78	,,aS12r   c                    ddd}ddd}ddd}| j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  dh       | j                  |j                         |j                         z  t                      | j                  |j                         t        |j                               z  ddh       | j                  |j                         t        |j                               z  dh       | j                  |j                         t        |j                               z  t                      | j                  |j                         d	z  ddh       | j                  |j                         d
z  dh       | j                  |j                         dz  t                      | j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  h d       | j                  |j                         |j                         z  h d       | j                  |j                         t        |j                               z  ddh       | j                  |j                         t        |j                               z  h d       | j                  |j                         t        |j                               z  h d       | j                  |j                         d	z  ddh       | j                  |j                         d
z  h d       | j                  |j                         dz  h d       | j                  |j                         |j                         z  t                      | j                  |j                         |j                         z  ddh       | j                  |j                         |j                         z  h d       | j                  |j                         d	z  t                      | j                  |j                         d
z  ddh       | j                  |j                         dz  h d       | j                  |j                         |j                         z
  t                      | j                  |j                         |j                         z
  dh       | j                  |j                         |j                         z
  ddh       | j                  |j                         t        |j                               z
  t                      | j                  |j                         t        |j                               z
  dh       | j                  |j                         t        |j                               z
  ddh       | j                  |j                         d	z
  t                      | j                  |j                         d
z
  dh       | j                  |j                         dz
  ddh       | j                  |j                         j	                  |j                                      | j                  |j                         j	                  |j                                      | j                  |j                         j	                  t        |j                                            | j                  |j                         j	                  t        |j                                            | j                  |j                         j	                  h d             | j                  |j                         j	                  g d             | j                  |j                         j	                  t        g d                   | j                  |j                         j	                  t        ddg                   | j                  |j                         j	                  i              | j                  |j                         j	                  |j                                      i }| j                  |j                         j	                  t                            | j                  |j                         j	                  g              | j                  |j                         j	                  |j                                      | j                  |j                         j	                  dg             y )Nr   r   rA   rC   rD   rE   r   r   r   r   )rc   rd   )r   r   rd   )r'   rC   r(   rD   >   rc   re   rd   >   rc   rd   rf   rg   re   >   rR   rS   rT   rU   rR   rS   )r!   r   r#   rY   rZ   r[   r<   )r   r\   r]   r^   r`   s        r   test_items_set_operationsz%DictSetTest.test_items_set_operations   s   111HHJ#h%9	;bhhj08*=bhhj0#%8c"((*o5"H-	/c"((*o5zBc"((*o5su=&::"H-	/&::XJG&::CEBbhhj0"H-	/bhhj07	9bhhj0A	Cc"((*o5"H-	/c"((*o57	9c"((*o5A	C&::"H-	/&::7	9&::A	C 	bhhj0#%8bhhj0"H-	/bhhj0A	C&::CEB&::"H-	/&::A	C 	bhhj0#%8bhhj08*=bhhj08X2FGc"((*o5su=c"((*o5zBc"((*o5(7KL&::CEB&::XJG&::Xx<PQ..rxxz:;..rxxz:;..tBHHJ/?@A..s288:?@
--o>?
--o>?
--c/.BCD
--c3*o>?
--b12
--bhhj9:
--ce45
--b12
--bhhj9:
--qc23r   c                    ddd}| j                  |j                         t        ddg      z  dh       | j                  |j                         t        ddg      z  h d       | j                  |j                         t        ddg      z  ddh       | j                  |j                         t        ddg      z
  dh       |j                         }| j                  |t        dg      z  dh       | j                  |t        dg      z  dh       | j                  |t        dg      z  ddh       | j                  |t        dg      z
  dh       y )	Nr   rC   )r   r/   r   >   r   r   r/   r/   r4   )r/   rC   )r!   r	   iterr   )r   originr   s      r   !test_set_operations_with_iteratorz-DictSetTest.test_set_operations_with_iterator   s!   1q!f5s;q!f5yAq!f51v>q!f5s;vh/&:vh/&:vh/&&1ABvh/&:r   c                    | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz
   d d d        | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz   d d d        | j                  t              5  i j                         dz
   d d d        y # 1 sw Y   bxY w# 1 sw Y   >xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr   )r
   r   r	   r   r   s    r   $test_set_operations_with_noniterablez0DictSetTest.test_set_operations_with_noniterable   s   y) 	GGIM	y) 	GGIM	y) 	GGIM	y) 	GGIM	 y) 	HHJN	y) 	HHJN	y) 	HHJN	y) 	HHJN	 		 		 		 		 		 		 		 		 	s_   F
F8F$)F1F=G	<G-G!
FF!$F.1F:=G	GG!G*c                     i }|j                         |d<   t        |      }| j                  |t               |j	                         |d<   t        |      }| j                  |t               y )Nr   )r   r:   r9   r;   r   r=   s      r   test_recursive_reprzDictSetTest.test_recursive_repr  sY    
"G 	a%	"Ga%r   c                     i }t        t        dz  dz         D ]  }d|j                         i} | j                  t        t
        |       y )Nr   d   r   )ranger   r   r
   RecursionErrorr:   )r   r'   is      r   test_deeply_nested_reprz#DictSetTest.test_deeply_nested_repr  sH    (!+c12 	!AQXXZ A	!.$2r   c                 @   ddd}| j                  t        t        j                  |j                                | j                  t        t        j                  |j	                                | j                  t        t        j                  |j                                y )Nr   r   r   )r
   r   r0   r	   r   r   r   r'   s     r   	test_copyzDictSetTest.test_copy  s`    )TYY9)TYY
;)TYY	:r   c                     G d dt                G fdd      } |        |       }} |        |       }}||i}| j                  ||       | j                  ||j                                | j                  ||j                                | j                  ||f|j	                                | j                  |j                  |       | j                  |j                         j                  |       | j                  |j	                         j                  ||f       | j                  |j	                         j                  ||f       | j                        5  ||j                         v  d d d        y # 1 sw Y   y xY w)Nc                       e Zd Zy)+DictSetTest.test_compare_error.<locals>.ExcN)rN   rO   rP   r.   r   r   Excr}   &  s    r   r~   c                       e Zd Zd Z fdZy)-DictSetTest.test_compare_error.<locals>.BadEqc                      y)N   r.   rn   s    r   __hash__z6DictSetTest.test_compare_error.<locals>.BadEq.__hash__*  s    r   c                     r   r.   )r   rK   r~   s     r   __eq__z4DictSetTest.test_compare_error.<locals>.BadEq.__eq__,  s    	r   N)rN   rO   rP   r   r   )r~   s   r   BadEqr   )  s    r   r   )	Exceptionr%   r	   r   r   r
   __contains__)r   r   k1k2v1v2r'   r~   s          @r   test_compare_errorzDictSetTest.test_compare_error%  s5   	) 		 	 %'B%'BHb!b!&&(#b!((*%r2h	*#q~~r2#qvvx44b9#qwwy55Bx@#qwwy55Bx@s# 	!((*	 	 	s   $F  F	c                    ddd}t        t        j                  dz         D ]  }| j                  t        t        j
                  ft        j                  |j                         |       | j                  t        t        j
                  ft        j                  |j                         |       | j                  t        t        j
                  ft        j                  |j                         |        y )Nr   r   r   r   )
rt   pickleHIGHEST_PROTOCOLr
   r   PicklingErrordumpsr	   r   r   )r   r'   protos      r   test_picklezDictSetTest.test_pickle?  s    622Q67 	0Ey&*>*>?affh/y&*>*>?ahhj%1y&*>*>?aggi0	0r   c                    t        d      }| j                  |j                         t        j                  j
                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         | j                  |j                         t        j                  j                         y )Nr   )r   )dictr9   r	   collectionsabcKeysViewMappingViewSetSizedIterable	Containerr   
ValuesView
Collectionr   	ItemsViewry   s     r   test_abc_registryzDictSetTest.test_abc_registryI  sK   1Iaffh(@(@Aaffh(C(CDaffh(;(;<affh(=(=>affh(@(@Aaffh(A(ABahhj+//*D*DEahhj+//*E*EFahhj+//*?*?@ahhj+//*D*DEahhj+//*B*BCahhj+//*C*CDaggi)B)BCaggi)D)DEaggi)<)<=aggi)>)>?aggi)A)ABaggi)B)BCr   N)rN   rO   rP   r   r)   r1   r5   r7   r?   ra   rh   rl   ro   rq   rw   rz   r   r   r   r.   r   r   r   r      sW    	)0(2.1)9 D3LH4T;&&3;40Dr   r   __main__)collections.abcr   r0   r   sysunittesttest.supportr   TestCaser   rN   mainr.   r   r   <module>r      sH       
  *WD(## WDt
 zHMMO r   