
    ;ej                         d Z ddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZ ddlZddlmZ eeee	fZe
efZeez   Z G d dej                  Zd Zedk    r ej                     dS dS )	zUnit tests for the copy module.    N)leltgegteqne)supportc                      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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#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. Z0d/ Z1d0 Z2d1 Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@d? ZAd@ ZBdA ZCdB ZDdC ZEdD ZFdE ZGdF ZHdG ZIdH ZJdI ZKdJ ZLdK ZMdL ZNdM ZOdN ZPdOS )PTestCopyc                     |                      t          j        t          j                   |                     t          t          j        t                               d S N)assertIscopyErrorerror
assertTrue
issubclass	Exceptionselfs    %/usr/lib/python3.11/test/test_copy.pytest_exceptionszTestCopy.test_exceptions   s>    dj$*---
4:y99:::::    c                 ^    d}t          j         |          }|                     ||           d S N*   )r   assertEqualr   xys      r   test_copy_basiczTestCopy.test_copy_basic   s0    IaLLAr   c                      G fddt                      d          }t          j        |          }|                     |j        |j                   |                     |j        |j                   d S )Nc                        e Zd Zd Z fdZdS )"TestCopy.test_copy_copy.<locals>.Cc                     || _         d S r   foor   r'   s     r   __init__z+TestCopy.test_copy_copy.<locals>.C.__init__!       r   c                 $     | j                   S r   r&   r   Cs    r   __copy__z+TestCopy.test_copy_copy.<locals>.C.__copy__#       q{{"r   N)__name__
__module____qualname__r)   r.   r-   s   r   r-   r$       s=          # # # # # # #r   r-   r   )objectr   r   	__class__r'   r   r   r    r-   s      @r   test_copy_copyzTestCopy.test_copy_copy   s    	# 	# 	# 	# 	# 	# 	# 	# 	# 	#
 AbEEIaLLak222&&&&&r   c                     G d dt                     fd} d          }|                     t          t          j        |           t	          j        |           t          j        |          }|                     ||           |                     t          |                     |                     |j	        |j	                   d S )Nc                       e Zd Zd ZdS )&TestCopy.test_copy_registry.<locals>.Cc                 H    t                               |           }||_        |S r   r4   __new__r'   clsr'   objs      r   r=   z.TestCopy.test_copy_registry.<locals>.C.__new__,       nnS))
r   Nr0   r1   r2   r=    r   r   r-   r:   +   #            r   r-   c                     | j         ffS r   r&   r@   r-   s    r   pickle_Cz-TestCopy.test_copy_registry.<locals>.pickle_C0       z?"r   r   )
r4   assertRaises	TypeErrorr   copyregpickleassertIsNotr   typer'   r   rG   r   r    r-   s       @r   test_copy_registryzTestCopy.test_copy_registry*   s    	 	 	 	 	 	 	 	
	# 	# 	# 	# 	#AbEE)TY222q(A&&&IaLLAa!$$$&&&&&r   c                      G fddt                     }g  |            }t          j        |          }|                     ||           |                     dg           d S )Nc                        e Zd Z fdZd ZdS )'TestCopy.test_copy_reduce_ex.<locals>.Cc                 2                         d           dS N    appendr   protocs     r   __reduce_ex__z5TestCopy.test_copy_reduce_ex.<locals>.C.__reduce_ex__<       rr   c                 0    |                      d           d S Nzshouldn't call thisfailr   s    r   
__reduce__z2TestCopy.test_copy_reduce_ex.<locals>.C.__reduce__?       		/00000r   Nr0   r1   r2   r]   rc   r\   s   r   r-   rS   ;   =            1 1 1 1 1r   r-   rV   r4   r   r   r   r   r-   r   r    r\   s       @r   test_copy_reduce_exzTestCopy.test_copy_reduce_ex:   s    	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 ACCIaLLaQC     r   c                      G fddt                     }g  |            }t          j        |          }|                     ||           |                     dg           d S )Nc                       e Zd Z fdZdS )$TestCopy.test_copy_reduce.<locals>.Cc                 2                         d           dS rU   rX   r   r\   s    r   rc   z/TestCopy.test_copy_reduce.<locals>.C.__reduce__I   r^   r   Nr0   r1   r2   rc   rf   s   r   r-   rm   H   .              r   r-   rV   rh   ri   s       @r   test_copy_reducezTestCopy.test_copy_reduceG   s    	 	 	 	 	 	 	 	 	 	 ACCIaLLaQC     r   c                      G d dt                     } |            }|                     t          j        t          j        |           d S )Nc                       e Zd Zd ZdS )"TestCopy.test_copy_cant.<locals>.Cc                     |                     d          rt          |          t                              | |          S N__reduce
startswithAttributeErrorr4   __getattribute__r   names     r   r|   z3TestCopy.test_copy_cant.<locals>.C.__getattribute__T   :    ??:.. /(.....tT:::r   Nr0   r1   r2   r|   rC   r   r   r-   ru   S   #        ; ; ; ; ;r   r-   )r4   rI   r   r   r   r-   r   s      r   test_copy_cantzTestCopy.test_copy_cantR   s[    	; 	; 	; 	; 	; 	; 	; 	;
 ACC$*di33333r   c                     G d d          } G d dt                     }d } G d dt          j                  }d d	t          d
ddz  dddddd|j        dt          t          d                    t          d          t          ddd          ||t          |t                      g}|D ]*}| 
                    t          j        |          |           +d S )Nc                       e Zd ZdS )*TestCopy.test_copy_atomic.<locals>.ClassicNr0   r1   r2   rC   r   r   Classicr   ^           Dr   r   c                       e Zd ZdS )+TestCopy.test_copy_atomic.<locals>.NewStyleNr   rC   r   r   NewStyler   `   r   r   r   c                      d S r   rC   rC   r   r   fz$TestCopy.test_copy_atomic.<locals>.fb       Dr   c                       e Zd ZdS )0TestCopy.test_copy_atomic.<locals>.WithMetaclassNr   rC   r   r   WithMetaclassr   d   r   r   r   	metaclass.r      d   Q	@TF              ?hello   helloሴs   world   
   rV   )r4   abcABCMetaNotImplemented__code__bytesrangeslicemaxpropertyr   r   )r   r   r   r   r   testsr   s          r   test_copy_atomiczTestCopy.test_copy_atomic]   s-   	 	 	 	 	 	 	 		 	 	 	 	v 	 	 		 	 		 	 	 	 	ck 	 	 	 	sNQVT4-5s,,eBiiq"a7C

	D
  	+ 	+AMM$)A,,****	+ 	+r   c                    g d}t          j         |          }|                     ||           |                     ||           g }t          j         |          }|                     ||           |                     ||           d S )NrV   r      r   r   rM   r   s      r   test_copy_listzTestCopy.test_copy_listn   s    IIIaLLAAIaLLAAr   c                 
   d}|                      t          j        |          |           d}|                      t          j        |          |           dddg f}|                      t          j        |          |           d S )Nr   rC   rV   r   r   )r   r   r   r   s     r   test_copy_tuplezTestCopy.test_copy_tuplex   ss    dillA&&&dillA&&&1bMdillA&&&&&r   c                    ddd}t          j         |          }|                     ||           |                     ||           i }t          j         |          }|                     ||           |                     ||           d S )NrV   r   r'   barr   r   s      r   test_copy_dictzTestCopy.test_copy_dict   s    a  IaLLAAIaLLAAr   c                 *   h d}t          j         |          }|                     ||           |                     ||           t                      }t          j         |          }|                     ||           |                     ||           d S N>   rV   r   r   )r   r   rM   setr   s      r   test_copy_setzTestCopy.test_copy_set   s    IIIaLLAAEEIaLLAAr   c                     t          h d          }|                     t          j        |          |           t                      }|                     t          j        |          |           d S r   )	frozensetr   r   r   s     r   test_copy_frozensetzTestCopy.test_copy_frozenset   sZ    iii  dillA&&&KKdillA&&&&&r   c                 @   t          d          }t          j        |          }|                     ||           |                     ||           t                      }t          j        |          }|                     ||           |                     ||           d S )Ns   abc)	bytearrayr   r   rM   r   s      r   test_copy_bytearrayzTestCopy.test_copy_bytearray   s    fIaLLAAKKIaLLAAr   c                      G d d          } |d          }|                      t          j        |          |           d S )Nc                       e Zd Zd Zd ZdS )*TestCopy.test_copy_inst_vanilla.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z3TestCopy.test_copy_inst_vanilla.<locals>.C.__init__   r*   r   c                 "    | j         |j         k    S r   r&   r   others     r   __eq__z1TestCopy.test_copy_inst_vanilla.<locals>.C.__eq__       x59,,r   Nr0   r1   r2   r)   r   rC   r   r   r-   r      2          - - - - -r   r-   r   r   r   r   s      r   test_copy_inst_vanillazTestCopy.test_copy_inst_vanilla   s]    	- 	- 	- 	- 	- 	- 	- 	-
 AbEE1q)))))r   c                      G fdd           d          }|                      t          j        |          |           d S )Nc                   &    e Zd Zd Z fdZd ZdS )'TestCopy.test_copy_inst_copy.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z0TestCopy.test_copy_inst_copy.<locals>.C.__init__   r*   r   c                 $     | j                   S r   r&   r,   s    r   r.   z0TestCopy.test_copy_inst_copy.<locals>.C.__copy__   r/   r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z.TestCopy.test_copy_inst_copy.<locals>.C.__eq__   r   r   N)r0   r1   r2   r)   r.   r   r3   s   r   r-   r      sL          # # # # #- - - - -r   r-   r   r   r   r   r-   s     @r   test_copy_inst_copyzTestCopy.test_copy_inst_copy   sh    	- 	- 	- 	- 	- 	- 	- 	- 	- 	- AbEE1q)))))r   c                      G d d          } |d          }|                      t          j        |          |           d S )Nc                        e Zd Zd Zd Zd ZdS ).TestCopy.test_copy_inst_getinitargs.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z7TestCopy.test_copy_inst_getinitargs.<locals>.C.__init__   r*   r   c                     | j         fS r   r&   r   s    r   __getinitargs__z>TestCopy.test_copy_inst_getinitargs.<locals>.C.__getinitargs__       {"r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z5TestCopy.test_copy_inst_getinitargs.<locals>.C.__eq__   r   r   Nr0   r1   r2   r)   r   r   rC   r   r   r-   r      A          # # #- - - - -r   r-   r   r   r   s      r   test_copy_inst_getinitargsz#TestCopy.test_copy_inst_getinitargs   ]    	- 	- 	- 	- 	- 	- 	- 	- AbEE1q)))))r   c                 .    G d dt                     } |d          }t          j        |          }|                     ||           |                     ||           |                     ||           |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )-TestCopy.test_copy_inst_getnewargs.<locals>.Cc                 H    t                               |           }||_        |S r   intr=   r'   r?   r'   r   s      r   r=   z5TestCopy.test_copy_inst_getnewargs.<locals>.C.__new__       {{3''r   c                     | j         fS r   r&   r   s    r   __getnewargs__z<TestCopy.test_copy_inst_getnewargs.<locals>.C.__getnewargs__       xy r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z4TestCopy.test_copy_inst_getnewargs.<locals>.C.__eq__   r   r   Nr0   r1   r2   r=   r   r   rC   r   r   r-   r      A          ! ! !- - - - -r   r-   r   r   r   assertIsInstancer   rM   r'   r   r-   r   r    s       r   test_copy_inst_getnewargsz"TestCopy.test_copy_inst_getnewargs   s    	- 	- 	- 	- 	- 	- 	- 	- AbEEIaLLa###AA&&&&&r   c                 0    G d dt                     } |d          }t          j        |          }|                     ||           |                     ||           |                     ||           |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )0TestCopy.test_copy_inst_getnewargs_ex.<locals>.Cc                H    t                               |           }||_        |S r   r   r   s      r   r=   z8TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__new__   r   r   c                     dd| j         ifS NrC   r'   r&   r   s    r   __getnewargs_ex__zBTestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__       E48,,,r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z7TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__eq__   r   r   Nr0   r1   r2   r=   r   r   rC   r   r   r-   r      A          - - -- - - - -r   r-   r   r&   r   r   s       r   test_copy_inst_getnewargs_exz%TestCopy.test_copy_inst_getnewargs_ex   s    	- 	- 	- 	- 	- 	- 	- 	- A"IIIIaLLa###AA&&&&&r   c                      G d d          } |d          }|                      t          j        |          |           d S )Nc                        e Zd Zd Zd Zd ZdS )+TestCopy.test_copy_inst_getstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z4TestCopy.test_copy_inst_getstate.<locals>.C.__init__   r*   r   c                     d| j         iS Nr'   r&   r   s    r   __getstate__z8TestCopy.test_copy_inst_getstate.<locals>.C.__getstate__       tx((r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z2TestCopy.test_copy_inst_getstate.<locals>.C.__eq__   r   r   Nr0   r1   r2   r)   r  r   rC   r   r   r-   r      A          ) ) )- - - - -r   r-   r   r   r   s      r   test_copy_inst_getstatez TestCopy.test_copy_inst_getstate   r   r   c                      G d d          } |d          }|                      t          j        |          |           d S )Nc                        e Zd Zd Zd Zd ZdS )+TestCopy.test_copy_inst_setstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z4TestCopy.test_copy_inst_setstate.<locals>.C.__init__   r*   r   c                      |d         | _         d S r  r&   r   states     r   __setstate__z8TestCopy.test_copy_inst_setstate.<locals>.C.__setstate__        <r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z2TestCopy.test_copy_inst_setstate.<locals>.C.__eq__   r   r   Nr0   r1   r2   r)   r  r   rC   r   r   r-   r     A          ( ( (- - - - -r   r-   r   r   r   s      r   test_copy_inst_setstatez TestCopy.test_copy_inst_setstate   r   r   c                      G d d          } |d          }|                      t          j        |          |            |d          }|                      t          j        |          |           d S )Nc                   &    e Zd Zd Zd Zd Zd ZdS )4TestCopy.test_copy_inst_getstate_setstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z=TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__init__   r*   r   c                     | j         S r   r&   r   s    r   r  zATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__getstate__   	    xr   c                     || _         d S r   r&   r  s     r   r  zATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__setstate__       r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z;TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__eq__  r   r   Nr0   r1   r2   r)   r  r  r   rC   r   r   r-   r     P               ! ! !- - - - -r   r-   r   g        r   r   s      r    test_copy_inst_getstate_setstatez)TestCopy.test_copy_inst_getstate_setstate   s    	- 	- 	- 	- 	- 	- 	- 	- AbEE1q)))AcFF1q)))))r   c                 ^    d}t          j        |          }|                     ||           d S r   )r   deepcopyr   r   s      r   test_deepcopy_basiczTestCopy.test_deepcopy_basic  s2    M!Ar   c                    g }||g}t          j        |          }|                     ||           |                     ||           |                     |d         |d                    |                     |d         |d                    d S Nr   rV   )r   r#  r   rM   r   r   s      r   test_deepcopy_memozTestCopy.test_deepcopy_memo  s     FM!AA1qt$$$adAaD!!!!!r   c                      G d dt                     } G d d|          }|                     t          j        |          |           d S )Nc                       e Zd ZdS )/TestCopy.test_deepcopy_issubclass.<locals>.MetaNr   rC   r   r   Metar*  "  r   r   r+  c                       e Zd ZdS ),TestCopy.test_deepcopy_issubclass.<locals>.CNr   rC   r   r   r-   r-  $  r   r   r-   r   )rN   r   r   r#  )r   r+  r-   s      r   test_deepcopy_issubclassz!TestCopy.test_deepcopy_issubclass  s    
	 	 	 	 	4 	 	 		 	 	 	 	$ 	 	 	 	q))1-----r   c                      G fddt                      d          }t          j        |          }|                     |j        |j                   |                     |j        |j                   d S )Nc                   "    e Zd Zd Zd fd	ZdS )*TestCopy.test_deepcopy_deepcopy.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z3TestCopy.test_deepcopy_deepcopy.<locals>.C.__init__*  r*   r   Nc                 $     | j                   S r   r&   r   memor-   s     r   __deepcopy__z7TestCopy.test_deepcopy_deepcopy.<locals>.C.__deepcopy__,  r/   r   r   )r0   r1   r2   r)   r6  r3   s   r   r-   r1  )  sB          # # # # # # # #r   r-   r   )r4   r   r#  r   r5   r'   r6   s      @r   test_deepcopy_deepcopyzTestCopy.test_deepcopy_deepcopy(  s    	# 	# 	# 	# 	# 	# 	# 	# 	# 	#
 AbEEM!ak222&&&&&r   c                     G d dt                     fd} d          }|                     t          t          j        |           t          j        |           t          j        |          }|                     ||           |                     t          |                     |                     |j
        |j
                   d S )Nc                       e Zd Zd ZdS )*TestCopy.test_deepcopy_registry.<locals>.Cc                 H    t                               |           }||_        |S r   r<   r>   s      r   r=   z2TestCopy.test_deepcopy_registry.<locals>.C.__new__5  rA   r   NrB   rC   r   r   r-   r:  4  rD   r   r-   c                     | j         ffS r   r&   rF   s    r   rG   z1TestCopy.test_deepcopy_registry.<locals>.pickle_C9  rH   r   r   )r4   rI   rJ   r   r#  rK   rL   rM   r   rN   r'   rO   s       @r   test_deepcopy_registryzTestCopy.test_deepcopy_registry3  s    	 	 	 	 	 	 	 	
	# 	# 	# 	# 	#AbEE)T]A666q(A&&&M!Aa!$$$&&&&&r   c                      G fddt                     }g  |            }t          j        |          }|                     ||           |                     dg           d S )Nc                        e Zd Z fdZd ZdS )+TestCopy.test_deepcopy_reduce_ex.<locals>.Cc                 2                         d           dS rU   rX   rZ   s     r   r]   z9TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce_ex__E  r^   r   c                 0    |                      d           d S r`   ra   r   s    r   rc   z6TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce__H  rd   r   Nre   rf   s   r   r-   r@  D  rg   r   r-   rV   r4   r   r#  r   r   ri   s       @r   test_deepcopy_reduce_exz TestCopy.test_deepcopy_reduce_exC  s    	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 ACCM!aQC     r   c                      G fddt                     }g  |            }t          j        |          }|                     ||           |                     dg           d S )Nc                       e Zd Z fdZdS )(TestCopy.test_deepcopy_reduce.<locals>.Cc                 2                         d           dS rU   rX   ro   s    r   rc   z3TestCopy.test_deepcopy_reduce.<locals>.C.__reduce__R  r^   r   Nrp   rf   s   r   r-   rG  Q  rq   r   r-   rV   rC  ri   s       @r   test_deepcopy_reducezTestCopy.test_deepcopy_reduceP  s    	 	 	 	 	 	 	 	 	 	 ACCM!aQC     r   c                      G d dt                     } |            }|                     t          j        t          j        |           d S )Nc                       e Zd Zd ZdS )&TestCopy.test_deepcopy_cant.<locals>.Cc                     |                     d          rt          |          t                              | |          S rw   ry   r}   s     r   r|   z7TestCopy.test_deepcopy_cant.<locals>.C.__getattribute__]  r   r   Nr   rC   r   r   r-   rL  \  r   r   r-   )r4   rI   r   r   r#  r   s      r   test_deepcopy_cantzTestCopy.test_deepcopy_cant[  s[    	; 	; 	; 	; 	; 	; 	; 	;
 ACC$*dmQ77777r   c                 $    G d d          } G d dt                     }d }d dt          ddd	z  d
dddddd|j        |t          d          |t          t                      g}|D ]*}|                     t          j        |          |           +d S )Nc                       e Zd ZdS ).TestCopy.test_deepcopy_atomic.<locals>.ClassicNr   rC   r   r   r   rQ  g  r   r   r   c                       e Zd ZdS )/TestCopy.test_deepcopy_atomic.<locals>.NewStyleNr   rC   r   r   r   rS  i  r   r   r   c                      d S r   rC   rC   r   r   r   z(TestCopy.test_deepcopy_atomic.<locals>.fk  r   r   .r   r   r   r   TFr   s   bytesr   r   r   )	r4   r   r   r   r   r   r   r   r#  )r   r   r   r   r   r   s         r   test_deepcopy_atomiczTestCopy.test_deepcopy_atomicf  s    	 	 	 	 	 	 	 		 	 	 	 	v 	 	 		 	 	sNB3dE27M1:599gsHJJ@  	/ 	/AMM$-**A....	/ 	/r   c                     ddgdg}t          j        |          }|                     ||           |                     ||           |                     |d         |d                    d S NrV   r   r   r   r   r#  r   rM   r   s      r   test_deepcopy_listzTestCopy.test_deepcopy_lists  n    VQKM!AA1qt$$$$$r   c                 T   g }|                     |           t          j        |          }t          D ]}|                     t
          |||            |                     ||           |                     |d         |           |                     t          |          d           d S r&  )
rY   r   r#  comparisonsrI   RecursionErrorrM   r   r   lenr   r   r    ops       r   test_deepcopy_reflexive_listz%TestCopy.test_deepcopy_reflexive_listz  s    	M! 	8 	8Bnb!Q7777AadAQ#####r   c                 ^    d}t          j        |          }|                     ||           d S NrC   r   r#  r   r   s      r   test_deepcopy_empty_tuplez"TestCopy.test_deepcopy_empty_tuple  s0    M!ar   c                     ddgdf}t          j        |          }|                     ||           |                     ||           |                     |d         |d                    d S rW  rX  r   s      r   test_deepcopy_tuplezTestCopy.test_deepcopy_tuple  rZ  r   c                 ^    d}t          j        |          }|                     ||           d S )N)rV   r   r   rd  r   s      r   !test_deepcopy_tuple_of_immutablesz*TestCopy.test_deepcopy_tuple_of_immutables  s0    M!ar   c                 l   g f}|d                              |           t          j        |          }t          D ]}|                     t
          |||            |                     ||           |                     |d         |d                    |                     |d         d         |           d S Nr   )rY   r   r#  r\  rI   r]  rM   r   r_  s       r   test_deepcopy_reflexive_tuplez&TestCopy.test_deepcopy_reflexive_tuple  s    E	!AM! 	8 	8Bnb!Q7777A1qt$$$ad1gq!!!!!r   c                     ddgdd}t          j        |          }|                     ||           |                     ||           |                     |d         |d                    d S )NrV   r   r   r   r'   rX  r   s      r   test_deepcopy_dictzTestCopy.test_deepcopy_dict  sr    F1%%M!AA51U8,,,,,r   c                    i }||d<   t          j        |          }t          D ]}|                     t          |||            t
          D ]}|                     t          |||            |                     ||           |                     |d         |           | 	                    t          |          d           d S )Nr'   rV   )r   r#  order_comparisonsrI   rJ   equality_comparisonsr]  rM   r   r   r^  r_  s       r   test_deepcopy_reflexive_dictz%TestCopy.test_deepcopy_reflexive_dict  s    %M!# 	3 	3BiQ2222& 	8 	8Bnb!Q7777Aah"""Q#####r   c                     i }g }t          j        ||          }|                     |t          |                   d         |           d S rl  )r   r#  r   idr   r5  r   r    s       r   test_deepcopy_keepalivez TestCopy.test_deepcopy_keepalive  sF    M!T""d2d88nQ'+++++r   c                 T   i }g d}t          j        ||          }|                     ||           |                     t          |          d           i }dg}t          j        ||          }|                     ||           |                     t          |          d           d S )N)rV   r   r      r   ri  )r   r#  r   r^  rv  s       r   !test_deepcopy_dont_memo_immutablez*TestCopy.test_deepcopy_dont_memo_immutable  s    LLM!T""ATA&&&HM!T""ATA&&&&&r   c                      G d d          } |dg          }t          j        |          }|                     ||           |                     |j        |j                   d S )Nc                       e Zd Zd Zd ZdS ).TestCopy.test_deepcopy_inst_vanilla.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z7TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__init__  r*   r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z5TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__eq__  r   r   Nr   rC   r   r   r-   r}    r   r   r-   r   r   r#  r   rM   r'   r   s       r   test_deepcopy_inst_vanillaz#TestCopy.test_deepcopy_inst_vanilla  s    	- 	- 	- 	- 	- 	- 	- 	-
 ArdGGM!A&&&&&r   c                      G fdd           dg          }t          j        |          }|                     ||           |                     ||           |                     |j        |j                   d S )Nc                   &    e Zd Zd Z fdZd ZdS )/TestCopy.test_deepcopy_inst_deepcopy.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z8TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__init__  r*   r   c                 J     t          j        | j        |                    S r   )r   r#  r'   r4  s     r   r6  z<TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__deepcopy__  s!    qtx66777r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z6TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__eq__  r   r   N)r0   r1   r2   r)   r6  r   r3   s   r   r-   r    sL          8 8 8 8 8- - - - -r   r-   r   r  r6   s      @r   test_deepcopy_inst_deepcopyz$TestCopy.test_deepcopy_inst_deepcopy  s    	- 	- 	- 	- 	- 	- 	- 	- 	- 	- ArdGGM!AA&&&&&r   c                      G d d          } |dg          }t          j        |          }|                     ||           |                     ||           |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )2TestCopy.test_deepcopy_inst_getinitargs.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z;TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__init__  r*   r   c                     | j         fS r   r&   r   s    r   r   zBTestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__getinitargs__  r   r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z9TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__eq__  r   r   Nr   rC   r   r   r-   r    r   r   r-   r   r  r   s       r   test_deepcopy_inst_getinitargsz'TestCopy.test_deepcopy_inst_getinitargs      	- 	- 	- 	- 	- 	- 	- 	- ArdGGM!AA&&&&&r   c                 p    G d dt                     } |dg          }t          j        |          }|                     ||           |                     ||           |                     ||           |                     |j        |j                   |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )1TestCopy.test_deepcopy_inst_getnewargs.<locals>.Cc                 H    t                               |           }||_        |S r   r   r   s      r   r=   z9TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__new__  r   r   c                     | j         fS r   r&   r   s    r   r   z@TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__getnewargs__  r   r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z8TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__eq__  r   r   Nr   rC   r   r   r-   r    r   r   r-   r   r   r   r#  r   r   rM   r'   r   s       r   test_deepcopy_inst_getnewargsz&TestCopy.test_deepcopy_inst_getnewargs  s    	- 	- 	- 	- 	- 	- 	- 	- ArdGGM!a###AA&&&&&&&&r   c                 r    G d dt                     } |dg          }t          j        |          }|                     ||           |                     ||           |                     ||           |                     |j        |j                   |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )4TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.Cc                H    t                               |           }||_        |S r   r   r   s      r   r=   z<TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__new__  r   r   c                     dd| j         ifS r   r&   r   s    r   r   zFTestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__  r   r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z;TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__eq__  r   r   Nr   rC   r   r   r-   r    r   r   r-   r   r&   r  r   s       r    test_deepcopy_inst_getnewargs_exz)TestCopy.test_deepcopy_inst_getnewargs_ex   s    	- 	- 	- 	- 	- 	- 	- 	- A2$KKKM!a###AA&&&&&&&&r   c                      G d d          } |dg          }t          j        |          }|                     ||           |                     ||           |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )/TestCopy.test_deepcopy_inst_getstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z8TestCopy.test_deepcopy_inst_getstate.<locals>.C.__init__  r*   r   c                     d| j         iS r  r&   r   s    r   r  z<TestCopy.test_deepcopy_inst_getstate.<locals>.C.__getstate__  r  r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z6TestCopy.test_deepcopy_inst_getstate.<locals>.C.__eq__  r   r   Nr  rC   r   r   r-   r    r  r   r-   r   r  r   s       r   test_deepcopy_inst_getstatez$TestCopy.test_deepcopy_inst_getstate  r  r   c                      G d d          } |dg          }t          j        |          }|                     ||           |                     ||           |                     |j        |j                   d S )Nc                        e Zd Zd Zd Zd ZdS )/TestCopy.test_deepcopy_inst_setstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   z8TestCopy.test_deepcopy_inst_setstate.<locals>.C.__init__"  r*   r   c                      |d         | _         d S r  r&   r  s     r   r  z<TestCopy.test_deepcopy_inst_setstate.<locals>.C.__setstate__$  r  r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z6TestCopy.test_deepcopy_inst_setstate.<locals>.C.__eq__&  r   r   Nr  rC   r   r   r-   r  !  r  r   r-   r   r  r   s       r   test_deepcopy_inst_setstatez$TestCopy.test_deepcopy_inst_setstate   r  r   c                     G d d          } |dg          }t          j        |          }|                     ||           |                     ||           |                     |j        |j                    |g           }t          j        |          }|                     ||           |                     ||           |                     |j        |j                   d S )Nc                   &    e Zd Zd Zd Zd Zd ZdS )8TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.Cc                     || _         d S r   r&   r(   s     r   r)   zATestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__init__0  r*   r   c                     | j         S r   r&   r   s    r   r  zETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__getstate__2  r  r   c                     || _         d S r   r&   r  s     r   r  zETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__setstate__4  r  r   c                 "    | j         |j         k    S r   r&   r   s     r   r   z?TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__eq__6  r   r   Nr  rC   r   r   r-   r  /  r   r   r-   r   r  r   s       r   $test_deepcopy_inst_getstate_setstatez-TestCopy.test_deepcopy_inst_getstate_setstate.  s    	- 	- 	- 	- 	- 	- 	- 	- ArdGGM!AA&&&AbEEM!AA&&&&&r   c                      G d d          } |            }||_         t          j        |          }|                     ||           |                     |j         |           d S )Nc                       e Zd ZdS )0TestCopy.test_deepcopy_reflexive_inst.<locals>.CNr   rC   r   r   r-   r  E  r   r   r-   )r'   r   r#  rM   r   r   s       r   test_deepcopy_reflexive_instz%TestCopy.test_deepcopy_reflexive_instD  s}    	 	 	 	 	 	 	 	ACCM!AaeQr   c                      G d dt                     } |            }t          j        |          }|                     ||           t          j        |          }|                     ||           d S )Nc                       e Zd Zd ZdS )+TestCopy.test_reconstruct_string.<locals>.Cc                     dS )NrW   rC   r   s    r   rc   z6TestCopy.test_reconstruct_string.<locals>.C.__reduce__Q  s    rr   Nrp   rC   r   r   r-   r  P  s#            r   r-   )r4   r   r   r#  r   s       r   test_reconstruct_stringz TestCopy.test_reconstruct_stringO  s    	 	 	 	 	 	 	 	 ACCIaLLaM!ar   c                 $    G fddt                                  }d|_        t          j        |          }|                     |j        |j                   t          j        |          }|                     |j        |j                   d S )Nc                       e Zd Z fdZdS ),TestCopy.test_reconstruct_nostate.<locals>.Cc                     dfS rc  rC   r,   s    r   rc   z7TestCopy.test_reconstruct_nostate.<locals>.C.__reduce__[  s    2wr   Nrp   r3   s   r   r-   r  Z  s.              r   r-   r   )r4   r'   r   r   r5   r#  r6   s      @r   test_reconstruct_nostatez!TestCopy.test_reconstruct_nostateY  s    	 	 	 	 	 	 	 	 	 	 ACCIaLLak1;///M!ak1;/////r   c                 >    G fddt                                  }dg|_        t          j        |          }|                     ||           t          j        |          }|                     ||           |                     |j        |j                   d S )Nc                        e Zd Z fdZd ZdS )*TestCopy.test_reconstruct_state.<locals>.Cc                     d| j         fS rc  __dict__r,   s    r   rc   z5TestCopy.test_reconstruct_state.<locals>.C.__reduce__f      2t}--r   c                 "    | j         |j         k    S r   r  r   s     r   r   z1TestCopy.test_reconstruct_state.<locals>.C.__eq__h      }66r   Nr0   r1   r2   rc   r   r3   s   r   r-   r  e  s=        . . . . .7 7 7 7 7r   r-   r   r4   r'   r   r   r#  rM   r6   s      @r   test_reconstruct_statezTestCopy.test_reconstruct_stated  s    	7 	7 	7 	7 	7 	7 	7 	7 	7 	7
 ACCIaLLAM!A&&&&&r   c                 >    G fddt                                  }dg|_        t          j        |          }|                     ||           t          j        |          }|                     ||           |                     |j        |j                   d S )Nc                   &    e Zd Z fdZd Zd ZdS )3TestCopy.test_reconstruct_state_setstate.<locals>.Cc                     d| j         fS rc  r  r,   s    r   rc   z>TestCopy.test_reconstruct_state_setstate.<locals>.C.__reduce__t  r  r   c                 :    | j                             |           d S r   )r  updater  s     r   r  z@TestCopy.test_reconstruct_state_setstate.<locals>.C.__setstate__v  s    $$U+++++r   c                 "    | j         |j         k    S r   r  r   s     r   r   z:TestCopy.test_reconstruct_state_setstate.<locals>.C.__eq__x  r  r   N)r0   r1   r2   rc   r  r   r3   s   r   r-   r  s  sL        . . . . ., , ,7 7 7 7 7r   r-   r   r  r6   s      @r   test_reconstruct_state_setstatez(TestCopy.test_reconstruct_state_setstater  s    	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 ACCIaLLAM!A&&&&&r   c                      G d dt                     } |            }||_        t          j        |          }|                     ||           |                     |j        |           d S )Nc                       e Zd ZdS ).TestCopy.test_reconstruct_reflexive.<locals>.CNr   rC   r   r   r-   r    r   r   r-   )r4   r'   r   r#  rM   r   r   s       r   test_reconstruct_reflexivez#TestCopy.test_reconstruct_reflexive  s    	 	 	 	 	 	 	 	ACCM!AaeQr   c                     G fddt                      ddgdg          }t          j        |          }|                     ||           |                     ||           |                     |d         |d                    t          j        |          }|                     ||           |                     ||           |                     |d         |d                    d S )Nc                        e Zd Z fdZd ZdS )&TestCopy.test_reduce_4tuple.<locals>.Cc                 4    d| j         t          |           fS rc  )r  iterr,   s    r   rc   z1TestCopy.test_reduce_4tuple.<locals>.C.__reduce__  s    2t}d4jj99r   c                 b    t          |           t          |          k    o| j        |j        k    S r   )listr  r   s     r   r   z-TestCopy.test_reduce_4tuple.<locals>.C.__eq__  ,    T

d5kk1 879r   Nr  r3   s   r   r-   r    s=        : : : : :9 9 9 9 9r   r-   rV   r   r   r   )r  r   r   rM   r   r#  r6   s      @r   test_reduce_4tuplezTestCopy.test_reduce_4tuple  s   	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 A1vqkNNIaLLAAadAaD!!!M!AA1qt$$$$$r   c                     G fddt                      dddgfdg          }t          j        |          }|                     ||           |                     ||           |                     |d         |d                    t          j        |          }|                     ||           |                     ||           |                     |d         |d                    d S )Nc                        e Zd Z fdZd ZdS )&TestCopy.test_reduce_5tuple.<locals>.Cc                 @    d| j         d |                                 fS rc  )r  itemsr,   s    r   rc   z1TestCopy.test_reduce_5tuple.<locals>.C.__reduce__  s    2t}dDJJLLAAr   c                 b    t          |           t          |          k    o| j        |j        k    S r   )dictr  r   s     r   r   z-TestCopy.test_reduce_5tuple.<locals>.C.__eq__  r  r   Nr  r3   s   r   r-   r    sB        B B B B B9 9 9 9 9r   r-   r'   rV   r   )r   r   )r  r   r   rM   r   r#  r6   s      @r   test_reduce_5tuplezTestCopy.test_reduce_5tuple  s	   	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 A1v
+,,IaLLAAah%)))M!AA51U8,,,,,r   c                 d     fd G fdd                       }                      t                    5  t          j        |           d d d            n# 1 swxY w Y                         t                    5  t          j        |           d d d            d S # 1 swxY w Y   d S )Nc                  2                         d           d S r`   ra   )argskwargsr   s     r   state_setterz1TestCopy.test_reduce_6tuple.<locals>.state_setter  s    II+,,,,,r   c                       e Zd Z fdZdS )&TestCopy.test_reduce_6tuple.<locals>.Cc                     d| j         d d fS rc  r  )r   r-   r  s    r   rc   z1TestCopy.test_reduce_6tuple.<locals>.C.__reduce__  s    "dmT4EEr   Nrp   )r-   r  s   r   r-   r    s;        F F F F F F F Fr   r-   rI   rJ   r   r#  )r   r   r-   r  s   ` @@r   test_reduce_6tuplezTestCopy.test_reduce_6tuple  sk   	- 	- 	- 	- 	-	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F ACCy)) 	 	IaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	M!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AA"%A"B%%B),B)c                 T    G fdd                       }|                      t                    5  t          j        |           d d d            n# 1 swxY w Y   |                      t                    5  t          j        |           d d d            d S # 1 swxY w Y   d S )Nc                       e Zd Z fdZdS )+TestCopy.test_reduce_6tuple_none.<locals>.Cc                     d| j         d d d fS rc  r  r,   s    r   rc   z6TestCopy.test_reduce_6tuple_none.<locals>.C.__reduce__  s    "dmT4==r   Nrp   r3   s   r   r-   r    s.        > > > > > > >r   r-   r  r   s     @r   test_reduce_6tuple_nonez TestCopy.test_reduce_6tuple_none  s@   	> 	> 	> 	> 	> 	> 	> 	> 	> 	> ACCy)) 	 	IaLLL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	M!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA;BB!$B!c                      G d dt                     } |            }dg|_        t          j        |          }|                     |j        |j                   d S )Nc                       e Zd ZdgZdS )#TestCopy.test_copy_slots.<locals>.Cr'   Nr0   r1   r2   	__slots__rC   r   r   r-   r            IIIr   r-   r   )r4   r'   r   r   r   s       r   test_copy_slotszTestCopy.test_copy_slots  sk    	  	  	  	  	  	  	  	 ACCIaLLaeQU#####r   c                      G d dt                     } |            }dg|_        t          j        |          }|                     |j        |j                   |                     |j        |j                   d S )Nc                       e Zd ZdgZdS )'TestCopy.test_deepcopy_slots.<locals>.Cr'   Nr  rC   r   r   r-   r    r  r   r-   r   )r4   r'   r   r#  r   rM   r   s       r   test_deepcopy_slotszTestCopy.test_deepcopy_slots  s    	  	  	  	  	  	  	  	 ACCM!&&&&&&&&r   c                 ~    G d dt                     } |ddi          }t          j        |          }|                     ||           |                     |j        |j                   |                     ||           d|d<   |                     ||           |                     |j        |j                   d S )Nc                   *     e Zd Zd fd	Z fdZ xZS )/TestCopy.test_deepcopy_dict_subclass.<locals>.CNc                     |si }t          |                                          | _        t                                          |           d S r   )r  keys_keyssuperr)   )r   dr5   s     r   r)   z8TestCopy.test_deepcopy_dict_subclass.<locals>.C.__init__  sC     A!!&&((^^
  #####r   c                     t                                          ||           || j        vr| j                            |           d S d S r   )r  __setitem__r  rY   )r   keyitemr5   s      r   r  z;TestCopy.test_deepcopy_dict_subclass.<locals>.C.__setitem__  sN    ##C...dj((J%%c***** )(r   r   )r0   r1   r2   r)   r  __classcell__)r5   s   @r   r-   r	    sV        $ $ $ $ $ $
+ + + + + + + + +r   r-   r'   r   )r  rV   r   )r  r   r#  r   r  rM   assertNotEqualr   s       r   test_deepcopy_dict_subclassz$TestCopy.test_deepcopy_dict_subclass  s    		+ 		+ 		+ 		+ 		+ 		+ 		+ 		+ Aq	NNNM!A!'***A%Aq!!!AGQW-----r   c                     G d dt                     } |ddgdg          }ddg|_        t          j        |          }|                     t          |          t          |                     |                     |j        |j                   |                     |d         |d                    |                     |j        |j                   d S )	Nc                       e Zd ZdS )+TestCopy.test_copy_list_subclass.<locals>.CNr   rC   r   r   r-   r    r   r   r-   rV   r   r   ry     r   )r  r'   r   r   r   r   s       r   test_copy_list_subclassz TestCopy.test_copy_list_subclass  s    	 	 	 	 	 	 	 	A1vqkNNAIaLLa$q''***&&&adAaD!!!aeQU#####r   c                     G d dt                     } |ddgdg          }ddg|_        t          j        |          }|                     t          |          t          |                     |                     |j        |j                   |                     |d         |d                    |                     |j        |j                   d S )	Nc                       e Zd ZdS )/TestCopy.test_deepcopy_list_subclass.<locals>.CNr   rC   r   r   r-   r    r   r   r-   rV   r   r   ry  r  r   )r  r'   r   r#  r   rM   r   s       r   test_deepcopy_list_subclassz$TestCopy.test_deepcopy_list_subclass  s    	 	 	 	 	 	 	 	A1vqkNNAM!a$q''***&&&1qt$$$&&&&&r   c                      G d dt                     } |g d          }|                     t          |          d           t          j        |          }|                     t          |          d           d S )Nc                       e Zd ZdS ),TestCopy.test_copy_tuple_subclass.<locals>.CNr   rC   r   r   r-   r!    r   r   r-   r   )tupler   r   r   s       r   test_copy_tuple_subclassz!TestCopy.test_copy_tuple_subclass   s    	 	 	 	 	 	 	 	AiiiLLq9---IaLLq9-----r   c                 ~    G d dt                     } |ddgdg          }|                     t          |          ddgdf           t          j        |          }|                     t          |          ddgdf           |                     ||           |                     |d         |d                    d S )Nc                       e Zd ZdS )0TestCopy.test_deepcopy_tuple_subclass.<locals>.CNr   rC   r   r   r-   r&  	  r   r   r-   rV   r   r   r   )r"  r   r   r#  rM   r   s       r   test_deepcopy_tuple_subclassz%TestCopy.test_deepcopy_tuple_subclass  s    	 	 	 	 	 	 	 	A1vqkNNqQFA;///M!qQFA;///A1qt$$$$$r   c                      G d dt                     }|                     t          t          j         |                       d S )Nc                       e Zd Zd ZdS )-TestCopy.test_getstate_exc.<locals>.EvilStatec                      t          d          )Nzain't got no stickin' state)
ValueErrorr   s    r   r  z:TestCopy.test_getstate_exc.<locals>.EvilState.__getstate__  s     !>???r   N)r0   r1   r2   r  rC   r   r   	EvilStater*    s(        @ @ @ @ @r   r-  )r4   rI   r,  r   )r   r-  s     r   test_getstate_exczTestCopy.test_getstate_exc  s\    	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	*di=====r   c                    |                      t          j        t                    t                     d }|                      t          j        |          |           d }|                      t          j        |          |           d S )Nc                     | |z   S r   rC   r   r    s     r   r'   z(TestCopy.test_copy_function.<locals>.foo  
    aczr   c                      d S r   rC   rC   r   r   <lambda>z-TestCopy.test_copy_function.<locals>.<lambda>      d r   )r   r   
global_foor   r'   r   s      r   test_copy_functionzTestCopy.test_copy_function  st    :..
;;;!!!3---l3-----r   c                    |                      t          j        t                    t                     d }|                      t          j        |          |           d }|                      t          j        |          |           d S )Nc                     | |z   S r   rC   r1  s     r   r'   z,TestCopy.test_deepcopy_function.<locals>.foo!  r2  r   c                      d S r   rC   rC   r   r   r4  z1TestCopy.test_deepcopy_function.<locals>.<lambda>#  r5  r   )r   r   r#  r6  r7  s      r   test_deepcopy_functionzTestCopy.test_deepcopy_function  sx    z22J???!!!s++S111ls++S11111r   c                      G d dt                     } |            }t          j        |          } ||          }|                     ||           ~ ||          }|                     ||           d S )Nc                       e Zd ZdS )"TestCopy._check_weakref.<locals>.CNr   rC   r   r   r-   r?  '  r   r   r-   )r4   weakrefrefr   )r   _copyr-   r@   r   r    s         r   _check_weakrefzTestCopy._check_weakref&  s    	 	 	 	 	 	 	 	accKE!HHaE!HHar   c                 D    |                      t          j                   d S r   )rC  r   r   s    r   test_copy_weakrefzTestCopy.test_copy_weakref1  s    DI&&&&&r   c                 D    |                      t          j                   d S r   )rC  r   r#  r   s    r   test_deepcopy_weakrefzTestCopy.test_deepcopy_weakref4  s    DM*****r   c                   
  G d dt                     

fdt          d          D             \  }}}} |            }|||<   |||<   t          j        |          }|                     ||           |                     ||           |                     ||         |           |                     ||         |           |                     t          |          d           ~~t          j                     |                     t          |          d            
             
            }	}|	||<   |                     ||           d S )Nc                       e Zd ZdS )(TestCopy._check_copy_weakdict.<locals>.CNr   rC   r   r   r-   rJ  8  r   r   r-   c                 $    g | ]}             S rC   rC   .0ir-   s     r   
<listcomp>z1TestCopy._check_copy_weakdict.<locals>.<listcomp>:  s    ,,,aaacc,,,r   ry  r   rV   )	r4   r   r   rM   r   r^  r	   
gc_collectassertNotIn)r   	_dicttypeabr\   r  uvr   r    r-   s             @r   _check_copy_weakdictzTestCopy._check_copy_weakdict7  sd   	 	 	 	 	 	 	 	,,,,588,,,
1aIKK!!IaLLAA1q!!!1q!!!Q###qQ###qssAACC1!Ar   c                 D    |                      t          j                   d S r   )rW  r@  WeakKeyDictionaryr   s    r   test_copy_weakkeydictzTestCopy.test_copy_weakkeydictL  s    !!'";<<<<<r   c                 D    |                      t          j                   d S r   )rW  r@  WeakValueDictionaryr   s    r   test_copy_weakvaluedictz TestCopy.test_copy_weakvaluedictO  s    !!'"=>>>>>r   c                     G d dt                     fdt          d          D             \  }}}}t          j                    }|||<   |||<   t	          j        |          }|                     ||           |                     t          |          d           | 	                    ||         |           | 	                    ||         |           |                     ||         j
        |j
                   |                     ||         j
        |j
                   ~t          j                     |                     t          |          d           d S )Nc                       e Zd Zd ZdS )-TestCopy.test_deepcopy_weakkeydict.<locals>.Cc                     || _         d S r   rN  r   rN  s     r   r)   z6TestCopy.test_deepcopy_weakkeydict.<locals>.C.__init__T      r   Nr0   r1   r2   r)   rC   r   r   r-   r`  S  #            r   r-   c                 &    g | ]} |          S rC   rC   rL  s     r   rO  z6TestCopy.test_deepcopy_weakkeydict.<locals>.<listcomp>V  !    ---qaadd---r   ry  r   rV   )r4   r   r@  rY  r   r#  r  r   r^  rM   rN  r	   rP  )r   rS  rT  r\   r  rU  rV  r-   s          @r   test_deepcopy_weakkeydictz"TestCopy.test_deepcopy_weakkeydictR  s[   	 	 	 	 	 	 	 	 .---E!HH---
1a%''!!M!Aq!!!Q###1q!!!1q!!!1%%%1%%%Q#####r   c                 B    G d dt                     fdt          d          D             \  }}}}t          j                    }|||<   |||<   t	          j        |          }|                     ||           |                     t          |          d           t          |
                                d           \  \  }}\  }	}
|                     ||           |                     |j        |j                   |                     ||           |                     |	|           |                     |	j        |j                   |                     |
|           ~~~	~
~t          j                     |                     t          |          d           d S )	Nc                       e Zd Zd ZdS )/TestCopy.test_deepcopy_weakvaluedict.<locals>.Cc                     || _         d S r   rb  rc  s     r   r)   z8TestCopy.test_deepcopy_weakvaluedict.<locals>.C.__init__h  rd  r   Nre  rC   r   r   r-   rl  g  rf  r   r-   c                 &    g | ]} |          S rC   rC   rL  s     r   rO  z8TestCopy.test_deepcopy_weakvaluedict.<locals>.<listcomp>j  rh  r   ry  r   c                     | d         j         S rl  rb  )pairs    r   r4  z6TestCopy.test_deepcopy_weakvaluedict.<locals>.<lambda>r  s    DGI r   )r  rV   )r4   r   r@  r\  r   r#  r  r   r^  sortedr  rM   rN  r   r	   rP  )r   rS  rT  r\   r  rU  rV  r   r    ztr-   s              @r   test_deepcopy_weakvaluedictz$TestCopy.test_deepcopy_weakvaluedictf  s   	 	 	 	 	 	 	 	 .---E!HH---
1a'))!!M!Aq!!!Q###		/E/EFFFAAAac"""aAac"""aq!QQ#####r   c                 (    G d dt                     } |            }|j        |_        t          j        |          }|                     |j        |j                   |                     |j        j        |           |                                 d S )Nc                       e Zd Zd ZdS )0TestCopy.test_deepcopy_bound_method.<locals>.Fooc                     d S r   rC   r   s    r   mz2TestCopy.test_deepcopy_bound_method.<locals>.Foo.m  s    r   N)r0   r1   r2   ry  rC   r   r   Foorw    s#            r   rz  )r4   ry  rT  r   r#  r   r   __self__)r   rz  r   gs       r   test_deepcopy_bound_methodz#TestCopy.test_deepcopy_bound_method~  s    	 	 	 	 	& 	 	 	 CEEcM!ac"""aclA&&&	r   N)Qr0   r1   r2   r   r!   r7   rP   rj   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r!  r$  r'  r.  r7  r=  rD  rI  rN  rU  rY  ra  re  rg  rj  rm  ro  rs  rw  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r#  r'  r.  r8  r<  rC  rE  rG  rW  rZ  r]  ri  rt  r}  rC   r   r   r   r      s       ; ; ;  
	' 	' 	'' ' ' ! ! !	! 	! 	!4 4 4+ + +"  ' ' '    ' ' '  * * *	* 	* 	*	* 	* 	*' ' '"' ' '"	* 	* 	*	* 	* 	** * *$  
	" 	" 	"	. 	. 	.	' 	' 	'' ' ' ! ! !	! 	! 	!8 8 8/ / /% % %$ $ $  
% % %  
" " "- - -
$ 
$ 
$, , ,' ' '	' 	' 	'' ' '' ' '' ' '$' ' '$' ' '' ' '' ' ',       	0 	0 	0' ' '' ' '      % % %"- - -"
 
 
  $ $ $' ' '. . .(	$ 	$ 	$	' 	' 	'. . .% % %> > >. . .2 2 2	 	 	' ' '+ + +  *= = =? ? ?$ $ $($ $ $0	 	 	 	 	r   r   c                     | |z   S r   rC   r1  s     r   r6  r6    s
    QqSjr   __main__)__doc__r   rK   r@  r   operatorr   r   r   r   r   r   unittesttestr	   rq  rr  r\  TestCaser   r6  r0   mainrC   r   r   <module>r     s   % %    



 + + + + + + + + + + + + + + + +       BN 2v "66w w w w wx  w w wt !    zHMOOOOO r   