
    <eݲ                       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 d dlZd dlm	Z	 d dl
Z
d dlmZ d dlZd dlZd dlZ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 d dlZd dlmZ d dlmZ d dlmZ d dlZ ej        d	d
g          Z ej        d	          Z ej        ddg          Z ej!        d             Z"d Z#d Z$ G d de%          Z& G d de%          Z' G d de(          Z) G d d          Z* ej+        ed           G d de*ej,                              Z- G d de*ej,                  Z.er G d d ej/                  Z0 G d! d"ej/                  Z1 ej+        ed           G d# d$e-                      Z2 G d% d&e.          Z3 G d' d(ej,                  Z4 G d) d*ej,                  Z5 G d+ d,e5          Z6 G d- d.          Z7 ej+        ed           G d/ d0e7ej,                              Z8 G d1 d2e7ej,                  Z9 G d3 d4          Z: ej+        ed           G d5 d6e:ej,                              Z; G d7 d8e:ej,                  Z< G d9 d:ej,                  Z=ej>         G d; d<                      Z? G d= d>          Z@ G d? d@          ZAeB                                dA             ZCeB                                dB             ZD G dC dDeAej,                  ZE G dE dFeAej,                  ZF G dG dHej,                  ZG G dI dJ          ZH G dK dL          ZI G dM dN          ZJ G dO dP          ZK G dQ dRej,                  ZLeMdSk    r ejN                     dS dS )T    N)permutations)choice)support)proxy)import_helper)threading_helper)assert_python_ok	functools
_functools)blockeddecimal_decimal)freshc              #      K   t           j        |          }|t           j        | <   	 d V  |t           j        | <   d S # |t           j        | <   w xY wN)sysmodules)namereplacementoriginal_modules      */usr/lib/python3.11/test/test_functools.pyreplaced_moduler   "   sV      k$'O#CK,+DOD++++s	   : Ac                  
    | |fS )z,capture all positional and keyword arguments )argskws     r   capturer   +   s    8O    c                 6    | j         | j        | j        | j        fS )z* return the signature of a partial object )funcr   keywords__dict__)parts    r   	signaturer$   0   s    Ity$-??r   c                       e Zd ZdS )MyTupleN__name__
__module____qualname__r   r   r   r&   r&   4           Dr   r&   c                       e Zd Zd ZdS )BadTuplec                 @    t          |           t          |          z   S r   )listselfothers     r   __add__zBadTuple.__add__8   s    DzzDKK''r   N)r(   r)   r*   r3   r   r   r   r-   r-   7   s#        ( ( ( ( (r   r-   c                       e Zd ZdS )MyDictNr'   r   r   r   r5   r5   ;   r+   r   r5   c                       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S )TestPartialc           	         |                      t          dddd          }|                     t          |                     |                      |dddd	
          dt          ddd	          f           |                      t          d           }|                     t           |g d                    g d           d S )N      
      ab         (   r?   cr9   r:   r@   rA   r>   r?   rE   c                     | dz  S )Nr;   r   xs    r   <lambda>z1TestPartial.test_basic_examples.<locals>.<lambda>F   s
    " r   )r;   r<   rB   rC   )partialr   
assertTruecallableassertEqualdictmapr/   r1   ps     r   test_basic_exampleszTestPartial.test_basic_examplesA   s    LL!Q"L33$$$1a2,,,&rR2(>(>(>?	A 	A 	ALLnn--aa			ll++-=-=-=>>>>>r   c                    |                      t          dddd          }|                     |j        t                     |                     |j        d           |                     |j        t          dd                     d S )Nr9   r:   r;   r<   r=   r9   r:   )rL   r   rO   r    r   r!   rP   rR   s     r   test_attributeszTestPartial.test_attributesI   sx    LL!Q"L33)))(((TB"%5%5%566666r   c                     |                      t          | j                   	  |                     d                       |                     d           d S # t          $ r Y d S w xY w)Nr:   z%First arg not checked for callability)assertRaises	TypeErrorrL   failr1   s    r   test_argument_checkingz"TestPartial.test_argument_checkingP   sv    )T\222	?DLLOO II=>>>>>  	 	 	DD	s   A 
A$#A$c                     d
d}ddi}|                      |d          }|                      |di |d           |                     |ddi            |d	           |                     |ddi           d S )Nr;   r<   c                     | S r   r   r=   s     r   r    zBTestPartial.test_protection_of_callers_dict_argument.<locals>.func[   s    Hr   r>   r@      r>      r?   )r;   r<   r   )rL   rO   )r1   r    drS   s       r   (test_protection_of_callers_dict_argumentz4TestPartial.test_protection_of_callers_dict_argumentY   s    	 	 	 	GLLL##Q###SG$$$	ASG$$$$$r   c                     ddi} | j         t          fi |}|                      |            dddif           d|d<   |                      |            dddif           d S )Nr>   r@   r   r`   rL   r   rO   )r1   rd   rS   s      r   test_kwargs_copyzTestPartial.test_kwargs_copyd   s}     !HDL&&A&&rC8n---#rC8n-----r   c                 z   |                      t                    }|                      |            di f           |                      |dd          di f           |                      t          dd          }|                      |            di f           |                      |dd          di f           d S )Nr   r9   r:   rV   r@   rA   rF   rg   rR   s     r   test_arg_combinationsz!TestPartial.test_arg_combinationsm   s     LL!!r2h'''1Q%---LL!Q''ubk***1Q)R11111r   c                 D   |                      t                    }|                     |j        i            |                      |            di f           |                      |d          dddif           |                      t          d          }|                     |j        ddi           |                      |            dddif           |                      |d          ddddf           |                      |dd          ddddf           d S )	Nr   r9   ra   r>   r:   rc   r=   r@   )rL   r   rO   r!   rR   s     r   test_kw_combinationsz TestPartial.test_kw_combinationsw   s(    LL!!R(((r2h'''Q"s1g///LLAL&&c!W---rC7m,,,Q"1!nn!5666Q!rq>>&:;;;;;r   c                     dD ]G} | j         t          g|R  }|dz   } |d          \  }}|                     ||k    o|i k               Hd S )N)r   r   r   r9   )r   r9   r:   )r   r9   r:   r@   rI   rJ   rL   r   rM   )r1   r   rS   expectedgotemptys         r   test_positionalzTestPartial.test_positional   sp    9 	= 	=DW,t,,,Af}H3JCOOHO;<<<<		= 	=r   c                     dD ]Q}|                      t          |          }|d d} |d           \  }}|                     ||k    o|dk               Rd S )N)r>   r   Ng      @ra   )r>   rJ   rI   r   rp   )r1   r>   rS   rq   rs   rr   s         r   test_keywordzTestPartial.test_keyword   sr    $ 	= 	=AW**A$''HTJE3OOHO;<<<<		= 	=r   c                     |                      t          dd          } |dd          \  }}|                     |dk    o|dddk                |            \  }}|                     |dk    o|d	dik               d S )
Nr   r9   ra   r:   rc   ro   r=   rn   r>   rp   )r1   rS   args1kw1args2kw2s         r   test_no_side_effectsz TestPartial.test_no_side_effects   s    LL!qL))QqAYYY
s?3qQ--+?@@@QSS
s8##a.99999r   c                    d }|                      t          |                     |dd                     |                      t          |                     |d          d           |                      t          |                     |          dd           |                      t          |                     |d          d           d S )Nc                     | |z   d S r   r   rJ   ys     r   fz-TestPartial.test_error_propagation.<locals>.f   s    EEEEr   r9   r   )r   )rY   ZeroDivisionErrorrL   r1   r   s     r   test_error_propagationz"TestPartial.test_error_propagation   s    	 	 	+T\\!Q-B-BCCC+T\\!Q-?-?CCC+T\\!__aCCC+T\\!q\-A-A1EEEEEr   c                 
   |                      t          d          }t          |          }|                     |j        |j                   d }t          j                     |                     t          t          |d           d S )N   )baser    )
rL   intr   rO   r    r   
gc_collectrY   ReferenceErrorgetattrr1   r   rS   s      r   test_weakrefzTestPartial.test_weakref   sp    LL2L&&!HH(((.'1f=====r   c                 T   t          t          t          t          d                              }|                     t          j        d          }|                      ||          d           |                     dj                  }|                      ||          d           d S )Nr;    
0123456789)r/   rQ   strrangerL   joinrO   )r1   datar   s      r   #test_with_bound_and_unbound_methodsz/TestPartial.test_with_bound_and_unbound_methods   s    CU2YY''((||CHb))d\222||BG$$d\22222r   c                     | j         } |t          d          } ||d          } |t          dd          }|                     t          |          t          |                     d S NasdfTbar)rL   r$   rO   )r1   rL   innernestedflats        r   test_nested_optimizationz$TestPartial.test_nested_optimization   sn    ,	6**D)))wy&d3336**IdOO<<<<<r   c                     | j         }d } ||d          } ||d          }d|_        |                     |j        d           d S )Nc                     | S r   r   r   s    r   fooz;TestPartial.test_nested_partial_with_attribute.<locals>.foo   s    Jr   firstsecondspam)rL   new_attrrO   )r1   rL   r   rS   p2s        r   "test_nested_partial_with_attributez.TestPartial.test_nested_partial_with_attribute   sa    ,	 	 	 GC!!WQ!!f-----r   c                    t                      t                      f}d                    d |D                       t                      t                      d}d                    |          d                    |          g}| j        t          j        t
          j        fv rdn| j        j        |                     t                    }|                      dt          dt          |                      | j        t          g|R  }|                      dt          d dt          |                      | j        t          fi |}| 
                    t          |          fd	|D                         | j        t          g|R i |}| 
                    t          |          fd
|D                        d S )N, c              3   4   K   | ]}t          |          V  d S r   )repr).0r>   s     r   	<genexpr>z(TestPartial.test_repr.<locals>.<genexpr>   s(      44!d1gg444444r   r=   za={a!r}, b={b!r}zb={b!r}, a={a!r}functools.partial()c                 0    g | ]} d t           d| dS r   r   r   r   )r   kwargs_reprr   s     r   
<listcomp>z)TestPartial.test_repr.<locals>.<listcomp>   sB     8 8 8& <<<<k<<< 8 8 8r   c           
      6    g | ]} d t           d d| dS r   r   )r   r   	args_reprr   s     r   r   z)TestPartial.test_repr.<locals>.<listcomp>   sJ     8 8 8& IIIIiII;III 8 8 8r   )objectr   
format_maprL   c_functoolspy_functoolsr(   r   rO   r   assertIn)r1   r   kwargskwargs_reprsr   r   r   s        @@r   	test_reprzTestPartial.test_repr   s   &((#II44t44444	xxfhh//*55f==*55f==?<K/1EFFF&DD<(DLL!!D//7///a999DL(4(((D<<7<<	<<<d1ggFFFDL++F++d1gg8 8 8 8*68 8 8	9 	9 	9 DL24222622d1gg8 8 8 8 8*68 8 8	9 	9 	9 	9 	9r   c                 B   | j         t          j         t          j         fv rd}n| j         j        }|                      t                    }|                    |di i f           	 |                     t          |          |d           |                    t          di i f           n## |                    t          di i f           w xY w|                      t                    }|                    t          |fi i f           	 |                     t          |          |dt          d           |                    t          di i f           n## |                    t          di i f           w xY w|                      t                    }|                    t          dd|ii f           	 |                     t          |          |dt          d           |                    t          di i f           d S # |                    t          di i f           w xY w)Nr   r   z(...)r   z, ...)r>   z, a=...))rL   r   r   r(   r   __setstate__rO   r   )r1   r   r   s      r   test_recursive_reprzTestPartial.test_recursive_repr   s   <K/1EFFF&DD<(DLL!!	2r2'''	2T!WW444&9:::NNGRR01111ANNGRR01111LL!!	!r2.///	2T!WWtttWWW&FGGGNNGRR01111ANNGRR01111LL!!	c1Xr2333	2T!WWwww&HIIINNGRR011111ANNGRR01111s$   #&B( ( C.E  E20.G> > Hc                    |                                  5  |                     t          dgdg          }g |_        t	          t
          j        dz             D ]Y}t          j        t          j        ||                    }| 	                    t          |          t          |                     Z	 d d d            d S # 1 swxY w Y   d S )Nr   Tr   r9   )
AllowPicklerL   r$   attrr   pickleHIGHEST_PROTOCOLloadsdumpsrO   r1   r   protof_copys       r   test_picklezTestPartial.test_pickle   s    	B 	BYtf==AAFv6:;; B Bfl1e&<&<==  6!2!2IaLLAAAAB	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	Bs   BC  CCc                    |                      t          dgdg          }g |_        t          j        |          }|                     t          |          t          |                     |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   d S r   )rL   r$   r   copyrO   assertIsr   r!   r1   r   r   s      r   	test_copyzTestPartial.test_copy  s    LLVH4&L9916**IaLL999fk16***fk16***foqz22222r   c                 J   |                      t          dgdg          }g |_        t          j        |          }|                     t          |          t          |                     |                     |j        |j                   |                     |j        |j                   |                     |j        d         |j        d                    |                     |j        |j                   |                     |j        d         |j        d                    d S )Nr   Tr   r   r   )	rL   r$   r   r   deepcopyrO   assertIsNotr   r!   r   s      r   test_deepcopyzTestPartial.test_deepcopy  s    LLVH4&L99q!!6**IaLL999af---af---Q333!*555/E1BCCCCCr   c           	      
   |                      t                    }|                    t          dt	          d          t	          g           f           |                     t          |          t          dt	          d          t	          g           f           |                      |dd          dddd	f           |                    t          dt	          d          d f           |                     t          |          t          dt	          d          i f           |                      |dd          dddd	f           |                    t          dd d f           |                      |dd          dd
dif           |                      |d          di f           |                      |            di f           |                    t          di d f           |                     t          |          t          di i f           |                      |dd          dd
dif           |                      |d          di f           |                      |            di f           d S )Nr9   r;   ra   r   r:   r<   rc   rV   r=   r?   r   )r:   )rL   r$   r   r   rP   rO   r   s     r   test_setstatezTestPartial.test_setstate  sf   LL##	tbzzz4R===ABBB1!4Tr]]]C	E 	E 	E1fBR.@.@%ABBB	tbzzz489991tbzzz2'FGGG1fBR.@.@%ABBB	tT23331fsBi%89991|,,,tRj)))	R.///1R'<===1dS"I%67771bz***r2h'''''r   c           	      |   |                      t                    }|                     t          |j        t
          di f           |                     t          |j        t
          di i d f           |                     t          |j        t
          di d g           |                     t          |j        d di d f           |                     t          |j        t
          d i d f           |                     t          |j        t
          g i d f           |                     t          |j        t
          dg d f           d S )Nr   )rL   r$   rY   rZ   r   r   r   s     r   test_setstate_errorsz TestPartial.test_setstate_errors2  s   LL##)Q^gr25FGGG)Q^gr2r45PQQQ)Q^gr2t5LMMM)Q^dBD5IJJJ)Q^gtR5NOOO)Q^gr2t5LMMM)Q^gr2t5LMMMMMr   c                    |                      t                    }|                    t          t	          d          t          d          d f           t          |          }|                     |t          dt          d          i f           |                     t          |d                   t                     |                     t          |d                   t                      |            }|                     |dddif           |                     t          |d                   t                     |                     t          |d                   t                     |                    t          t          d          i d f           t          |          }|                     |t          di i f           |                     t          |d                   t                      |d          }|                     |di f           |                     t          |d                   t                     d S )	Nr   r;   ra   r9   r:   r>   r   rV   )rL   r$   r   r   r&   r5   rO   rP   r   typetupler-   )r1   r   srs       r   test_setstate_subclassesz$TestPartial.test_setstate_subclasses<  s   LL##	dCDDDaLLWdD2JJJ;<<<d1Q4jj%(((d1Q4jj$'''ACCTC9-...d1Q4jj%(((d1Q4jj$'''	$T:;;;aLLWdB3444d1Q4jj%(((AaDDVRL)))d1Q4jj%(((((r   c           
         |                                  5  |                     t                    }|                    |di i f           	 t	          t
          j        dz             D ]I}|                     t                    5  t          j	        ||           d d d            n# 1 swxY w Y   J	 |                    t          di i f           n## |                    t          di i f           w xY w|                     t                    }|                    t          |fi i f           	 t	          t
          j        dz             D ]}t          j
        t          j	        ||                    }	 |                     |j        d         |           |                    t          di i f           j# |                    t          di i f           w xY w	 |                    t          di i f           n## |                    t          di i f           w xY w|                     t                    }|                    t          dd|ii f           	 t	          t
          j        dz             D ]}t          j
        t          j	        ||                    }	 |                     |j        d         |           |                    t          di i f           j# |                    t          di i f           w xY w	 |                    t          di i f           n## |                    t          di i f           w xY w	 d d d            d S # 1 swxY w Y   d S )Nr   r9   r   r>   )r   rL   r   r   r   r   r   rY   RecursionErrorr   r   r   r   r!   r   s       r   test_recursive_picklez!TestPartial.test_recursive_pickleP  s     	6  	6W%%ANNAr2r?+++6"6#:Q#>?? / /E**>:: / /Q.../ / / / / / / / / / / / / / // R45555R45555W%%ANNGaT2r23336"6#:Q#>?? C CE#\&,q%*@*@AAFCfk!nf===++Wb"b,ABBBB++Wb"b,ABBBBC R45555R45555W%%ANNGR#q267776"6#:Q#>?? C CE#\&,q%*@*@AAFCfoc&:FCCC++Wb"b,ABBBB++Wb"b,ABBBBC R45555R455555A 	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6  	6s   4M
8CB$C$B((C+B(,C1M C00<M-AG63!F3G63 GG6M6 H=MAL!K;L K::L>M L==MMMc                      G d d          }|                      t                    }|                     t          |j         |                       d S )Nc                       e Zd Zd Zd ZdS )7TestPartial.test_setstate_refcount.<locals>.BadSequencec                     dS )NrA   r   r\   s    r   __len__z?TestPartial.test_setstate_refcount.<locals>.BadSequence.__len__v      qr   c                 z    |dk    rt           S |dk    rt          t          d                    S |dv ri S t          )Nr   r9   i@B )r:   r@   )maxr   r   
IndexError)r1   keys     r   __getitem__zCTestPartial.test_setstate_refcount.<locals>.BadSequence.__getitem__x  sA    !88JAXX w000F]]I  r   N)r(   r)   r*   r   r   r   r   r   BadSequencer   u  s2          ! ! ! ! !r   r   )rL   r   rY   rZ   r   )r1   r   r   s      r   test_setstate_refcountz"TestPartial.test_setstate_refcountt  sc    
	! 
	! 
	! 
	! 
	! 
	! 
	! 
	! LL  )Q^[[]]CCCCCr   N)r(   r)   r*   rT   rW   r]   re   rh   rj   rl   rt   rv   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   r7   ?   s       ? ? ?7 7 7? ? ?	% 	% 	%. . .2 2 2< < <= = == = =: : :F F F> > >3 3 3= = =
. 
. 
.9 9 962 2 26B B B3 3 3	D 	D 	D( ( (2N N N) ) )(!6 !6 !6HD D D D Dr   r7   z requires the C _functools modulec                   L    e Zd Zerej        Z G d d          Zd Zd Zd ZdS )TestPartialCc                       e Zd Zd Zd ZdS )TestPartialC.AllowPicklec                     | S r   r   r\   s    r   	__enter__z"TestPartialC.AllowPickle.__enter__  s    Kr   c                     dS NFr   r1   r   valuetbs       r   __exit__z!TestPartialC.AllowPickle.__exit__  s    5r   N)r(   r)   r*   r   r   r   r   r   r   r     s2        	 	 		 	 	 	 	r   r   c           
         |                      t          dddd          }|                     t          t          |dt
                     |                     t          t          |dd           |                     t          t          |d	t          dd                     |                      t                    }	 |`| 	                    d
           d S # t          $ r Y d S w xY w)Nr9   r:   r;   r<   r=   r    r   rV   r!   z-partial object allowed __dict__ to be deleted)rL   r   rY   AttributeErrorsetattrrQ   rP   hexr"   r[   rZ   rR   s     r   test_attributes_unwritablez'TestPartialC.test_attributes_unwritable  s    LL!Q"L33.'1fcBBB.'1ffEEE.'1j$a...QQQLL	G
 IIEFFFFF  	 	 	DD	s   8C 
CCc                 >   |                      t                    }d|j        d<   t          |          }|                     d|           |                     d|           |                     t                    5   |             d d d            d S # 1 swxY w Y   d S )Nr   i  1234z'value')rL   r   r!   r   r   rY   rZ   )r1   rS   r   s      r   'test_manually_adding_non_string_keywordz4TestPartialC.test_manually_adding_non_string_keyword  s    LL!!"
4GGfa   i###y)) 	 	ACCC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   :BBBc                    |                      t                     G fddt                    }dgj         |            <   t	                    }|                     d|           |                     d|           d S )Nc                       e Zd Z fdZdS )@TestPartialC.test_keystr_replaces_value.<locals>.MutatesYourDictc                     dgj         | <   dS )Nsth2astr)r!   rR   s    r   __str__zHTestPartialC.test_keystr_replaces_value.<locals>.MutatesYourDict.__str__  s    $*8
4 vr   N)r(   r)   r*   r  )rS   s   r   MutatesYourDictr	    s.              r   r  sthr  z['sth'])rL   r   r   r!   r   r   )r1   r  r   rS   s      @r   test_keystr_replaces_valuez'TestPartialC.test_keystr_replaces_value  s    LL!!	 	 	 	 	 	 	f 	 	 	 */
??$$%GGfa   i#####r   N)	r(   r)   r*   r   rL   r   r  r  r  r   r   r   r   r     s|         &%       G G G  $ $ $ $ $r   r   c                   6    e Zd Zej        Z G d d          ZdS )TestPartialPyc                        e Zd Zd Zd Zd ZdS )TestPartialPy.AllowPicklec                 :    t          dt                    | _        d S )Nr
   )r   r   _cmr\   s    r   __init__z"TestPartialPy.AllowPickle.__init__  s    &{LAADHHHr   c                 4    | j                                         S r   )r  r   r\   s    r   r   z#TestPartialPy.AllowPickle.__enter__  s    8%%'''r   c                 :    | j                             |||          S r   )r  r   r   s       r   r   z"TestPartialPy.AllowPickle.__exit__  s    8$$T5"555r   N)r(   r)   r*   r  r   r   r   r   r   r   r    sD        	B 	B 	B	( 	( 	(	6 	6 	6 	6 	6r   r   N)r(   r)   r*   r   rL   r   r   r   r   r  r    sD        "G6 6 6 6 6 6 6 6 6 6r   r  c                       e Zd ZdS )CPartialSubclassNr'   r   r   r   r  r    s        r   r  c                       e Zd ZdS )PyPartialSubclassNr'   r   r   r   r  r    r+   r   r  c                       e Zd ZereZdZdS )TestPartialCSubclassN)r(   r)   r*   r   r  rL   r   r   r   r   r  r    s%         #"  $r   r  c                       e Zd ZeZdS )TestPartialPySubclassN)r(   r)   r*   r  rL   r   r   r   r!  r!    s        GGGr   r!  c                       e Zd Z G d de          Z 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S )TestPartialMethodc                      e Zd Z ej        e          Z ej        ed          Z ej        ed          Z ej        edd          Z	 ej        edd          Z
 ej        ed          Z ej         ej        ed	
          d          Z ej         ee          d          Z ej         ee          d          ZdS )TestPartialMethod.Ar9   r:   ra   r@   rA   rc   r1   r    r`      rE   rb      	   rd   N)r(   r)   r*   r
   partialmethodr   nothing
positionalr!   bothspec_keywordsr   rL   over_partialstaticmethodstaticclassmethodclsr   r   r   Ar%    s        )))'22,Y,Wa88
*9*7a888&y&wQ777/	/aaHHH((Q77.y./@y/@A/N/N/NPQRR((g)>)>BB%i%kk'&:&:a@@@r   r6  c                 $   |                      | j                                        | j        fi f           |                      | j                            d          | j        dfi f           |                      | j                            d          | j        fddif           |                      | j                            dd          | j        dfddif           |                      | j                                        | j        dfi f           |                      | j                            d          | j        ddfi f           |                      | j                            d          | j        dfddif           |                      | j                            dd          | j        ddfddif           |                      | j                                        | j        fddif           |                      | j                            d          | j        dfddif           |                      | j                            d          | j        fdddf           |                      | j                            dd          | j        dfdddf           |                      | j                                        | j        d	fd
dif           |                      | j                            d          | j        d	dfd
dif           |                      | j                            d          | j        d	fdddf           |                      | j                            dd          | j        d	dfdddf           |                      | j                            | j        dd          | j        d	dfdddf           |                      | j                                        | j        fdddf           d S )Nr`   r'  r(  rE   r9   r>   r:   )r>   rE   r@   r?   rA   rD   r&  )rO   r>   r-  r.  r!   r/  r6  r0  r\   s    r   rj   z'TestPartialMethod.test_arg_combinations  s   ))TVIr?;;;**dfa[",=>>>!,,y3(.CDDDQ//461+Qx1HIII**,,{B.?@@@**1--A/CDDD**Q*//461+Qx1HIII**1*22dfa^c1X4NOOO**dfYa,ABBB++tvqkC8-DEEE1--	;K;K/LMMMa00DFA;aa@P@P2QRRR$&!sAh(?@@@Q461a.3()CDDDq))TVQKqq9I9I+JKKKQ!,,1~QQ?O?O.PQQQTVQ!441~QUVGWGW6XYYY--//46)aQR=S=S1TUUUUUr   c                 \   |                      | j                                        | j        ddfi f           |                      | j                            d          | j        dddfi f           |                      | j                            d          | j        ddfddif           |                      | j                            dd          | j        dddfddif           |                      | j                            | j        dd          | j        dddfddif           d S )Nr9   r`   r'  rb   r+  rd   )rO   r>   r   r6  r\   s    r   test_nestedzTestPartialMethod.test_nested   s   DFAq>2*>???q))TVQ1,=r+BCCC++tvq!nsAh-GHHHqA..$&!Q1BS!H0MNNNtvqA66$&!Q9JSRSH8UVVVVVr   c                 `   |                      | j                                        | j        dfddif           |                      | j                            d          | j        ddfddif           |                      | j                            d          | j        dfdddf           |                      | j                            dd          | j        ddfdddf           |                      | j                            | j        dd          | j        ddfdddf           d S )Nrb   rE   r'  r`   r)  r+  rE   rd   )rO   r>   r1  r6  r\   s    r   test_over_partialz#TestPartialMethod.test_over_partial  s5   ,,..$&!sAh0GHHH,,Q//461a.3(1KLLL,,q,11TVQKqqAQAQ3RSSS,,Q!,441~QUVGWGW6XYYY,,TVQ!,<<1~UV]^O_O_>`aaaaar   c                 r   | j         }|                     |j        j        |           |                     |j        j        |           |                     |j        j        |           |                     |j        j        | j                   |                     | j        j        j        | j                   d S r   )r>   r   r/  __self__r   r1  r5  r6  r1   objs     r   test_bound_method_introspectionz1TestPartialMethod.test_bound_method_introspection  s    fch'---cj)3///c&/555cg&///dfj)4622222r   c                    | j         }|                     t          |j        d                     |                     t          |j        d                     |                     t          |j        d                     |                     t          |j        d                     |                     t          | j        j        d                     d S )Nr>  )r6  assertFalsehasattrr/  r   r1  r3  r>   r?  s     r   test_unbound_method_retrievalz/TestPartialMethod.test_unbound_method_retrieval  s    f:66777Z88999!1:>>???Z88999
;;<<<<<r   c           	         | j         | j        fD ]}|                     |          5  |                     |                                di f           |                     |                    d          di f           |                     |                    d          dddif           |                     |                    dd          dddif           |                     |                                | j         fddif           |                     |                    d          | j         dfddif           |                     |                    d	          | j         fddd
f           |                     |                    dd	          | j         dfddd
f           d d d            n# 1 swxY w Y   d S )Nr@  )r)  r`   )r)  r`   r)  r+  rd   r*  r(  r;  )r6  r>   subTestrO   r3  r5  r?  s     r   test_descriptorsz"TestPartialMethod.test_descriptors   s   FDF# 
	S 
	SC#&& 	S 	S  bz:::  A===  a4#q2BCCC  A!3!3fsAh5GHHH  dfYa,ABBB  tvqkC8-DEEE  1	;K;K/LMMM  aDFA;aa@P@P2QRRR	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S
	S 
	Ss   FF99F=	 F=	c                     |                      | j                            d          | j        fddif           |                      | j                            | j        d          | j        fddif           d S )Nr@   ra   r>   )rO   r>   r!   r6  r\   s    r   test_overriding_keywordsz*TestPartialMethod.test_overriding_keywords-  sr    1--	C8/DEEE155	C87LMMMMMr   c                    |                      t                    5   G d dt                    }d d d            n# 1 swxY w Y   |                      t                    5   G d d          }d d d            n# 1 swxY w Y   |                      t                    5   G d d          }d d d            d S # 1 swxY w Y   d S )Nc                   0    e Zd Z ej        dd          ZdS ).TestPartialMethod.test_invalid_args.<locals>.BNr9   r(   r)   r*   r
   r,  methodr   r   r   BrN  3  s"        00q99r   rQ  c                   ,    e Zd Z ej                    ZdS )rN  NrO  r   r   r   rQ  z.TestPartialMethod.test_invalid_args.<locals>.B6  s        0022r   c                   2    e Zd Z ej        ed          ZdS )rN  r9   )r    r>   N)r(   r)   r*   r
   r,  r   rP  r   r   r   rQ  z.TestPartialMethod.test_invalid_args.<locals>.B9  s%        00gCCCr   )rY   rZ   r   )r1   rQ  s     r   test_invalid_argsz#TestPartialMethod.test_invalid_args1  s   y)) 	: 	:: : : : :F : : :	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: y)) 	3 	33 3 3 3 3 3 3 3	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 y)) 	D 	DD D D D D D D D	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds1   ;?? A::A>A>B::B>B>c                     |                      t          t          | j                  d                   d                    t
                               d S )Nr/  z#functools.partialmethod({}, 3, b=4))rO   r   varsr6  formatr   r\   s    r   r   zTestPartialMethod.test_repr<  sQ    d46ll6233>EEgNN	P 	P 	P 	P 	Pr   c                 r    G d dt           j                  }|                     |j        j                   |                     |j        j                   | j        j        | j        j        | j        j	        | j        j
        | j        j        fD ]&}|                     t          |dd                     'd S )Nc                   P    e Zd Zej        d             Z ej        ed          ZdS )1TestPartialMethod.test_abstract.<locals>.Abstractc                     d S r   r   r1   rJ   r   s      r   addz5TestPartialMethod.test_abstract.<locals>.Abstract.addC  s    r   r`   N)	r(   r)   r*   abcabstractmethodr]  r
   r,  add5r   r   r   AbstractrZ  A  sA            +9*322DDDr   ra  __isabstractmethod__F)r^  ABCMetarM   r]  rb  r`  r6  r3  r5  r1  r   r/  rC  r   )r1   ra  r    s      r   test_abstractzTestPartialMethod.test_abstract@  s    	3 	3 	3 	3 	3s{ 	3 	3 	3 	9::::;;;V]DFJ0CTV]TXTZT_` 	K 	KDWT+A5IIJJJJ	K 	Kr   c                     d }t          j        |d          }|                      |d           |dd                     d S )Nc                    | |z   S r   r   r=   s     r   r   z1TestPartialMethod.test_positional_only.<locals>.fP      q5Lr   r9   r:   )r
   rL   rO   r   s      r   test_positional_onlyz&TestPartialMethod.test_positional_onlyO  sS    	 	 	 a##1qqAww'''''r   N)r(   r)   r*   r   r6  r>   rj   r9  r<  rA  rE  rI  rK  rT  r   rd  rh  r   r   r   r#  r#    s       A A A A AF A A A 	
AV V V2W W Wb b b3 3 3= = =S S SN N N	D 	D 	DP P PK K K( ( ( ( (r   r#  c                      e Zd Zej        ej        fdZd Zd Z e	j
        ej        j        dk    d          d             Zd Zd Zd	 Zej         e	j
        ej        j        dk    d          d
                         ZdS )TestUpdateWrapperc                 \   |D ]4}|                      t          ||          t          ||                     5|D ]V}t          ||          }t          ||          }|D ]1}|dk    r|dk    r|                      ||         ||                    2W|                      |j        |           d S )Nr"   __wrapped__)r   r   rl  )	r1   wrapperwrappedassignedupdatedr   wrapper_attrwrapped_attrr   s	            r   check_wrapperzTestUpdateWrapper.check_wrapperY  s      	J 	JDMM''400''42H2HIIII 	D 	DD"7D11L"7D11L# D D:%%#*>*>l3/c1BCCCC	D 	g)733333r   c                 `    d	d}d|_         d|_        d
d}t          j        ||           ||fS )Nr>   This is a new annotationc                     dS This is a testNr   ra   s    r   r   z,TestUpdateWrapper._default_update.<locals>.fm      Dr   This is also a testzThis is a bald faced lier?   This is the prior annotationc                     d S r   r   rc   s    r   rm  z2TestUpdateWrapper._default_update.<locals>.wrapperr      Dr   )r>   ru  )r?   r{  )r   rl  r
   update_wrapperr1   r   rm  s      r   _default_updatez!TestUpdateWrapper._default_updatel  sW    	 	 	 	 '2	 	 	 	 !,,,zr   c                    |                                  \  }}|                     ||           |                     |j        |           |                     |j        d           |                     |j        |j                   |                     |j        d           |                     |j        d         d           | 	                    d|j                   d S )Nr   rz  r>   ru  r?   )
r  rs  r   rl  rO   r(   r*   r   __annotations__assertNotInr1   rm  r   s      r   test_default_updatez%TestUpdateWrapper.test_default_updatew  s    ))++
7A&&&g)1---)3///-q~>>>'<===057QRRRg566666r   r:   )Docstrings are omitted with -O2 and abovec                 j    |                                  \  }}|                     |j        d           d S Nrx  r  rO   __doc__r  s      r   test_default_update_docz)TestUpdateWrapper.test_default_update_doc  8     ))++
*:;;;;;r   c                    d }d|_         d }t          j        ||dd           |                     ||dd           |                     |j        d           |                     |j        |j                   |                     |j        d            |                     |j	        i            | 
                    t          |d                     d S )Nc                      dS rw  r   r   r   r   r   z+TestUpdateWrapper.test_no_update.<locals>.f  ry  r   rz  c                      d S r   r   r   r   r   rm  z1TestUpdateWrapper.test_no_update.<locals>.wrapper  r}  r   r   rm  r   )r   r
   r~  rs  rO   r(   assertNotEqualr*   r  r  rC  rD  r  s      r   test_no_updatez TestUpdateWrapper.test_no_update  s    	 	 	 '	 	 	 !R4447Ar2...)9555G0!.AAA$///0"555&1122222r   c                    d }d|_         t          ddd          |_        d }i |_        d}d	}t          j        ||||           |                     ||||           |                     |j        d
           |                     |j	        |j	                   |                     |j
        d            |                     |j         d           |                     |j        |j                   d S )Nc                      d S r   r   r   r   r   r   z2TestUpdateWrapper.test_selective_update.<locals>.f  r}  r   This is a different testr9   r:   r@   rG   c                      d S r   r   r   r   r   rm  z8TestUpdateWrapper.test_selective_update.<locals>.wrapper  r}  r   r   	dict_attrrm  )r   rP   r  r
   r~  rs  rO   r(   r  r*   r  r1   r   rm  assignupdates        r   test_selective_updatez'TestUpdateWrapper.test_selective_update  s   	 	 	+Q!q)))	 	 	 !VV<<<7Avv666)9555G0!.AAA$///'ABBB*AK88888r   c                    d }d }i |_         d}d}t          j        ||||           |                     d|j                   |                     |j         i            |` |                     t                    5  t          j        ||||           d d d            n# 1 swxY w Y   d|_         |                     t                    5  t          j        ||||           d d d            d S # 1 swxY w Y   d S )Nc                      d S r   r   r   r   r   r   z4TestUpdateWrapper.test_missing_attributes.<locals>.f  r}  r   c                      d S r   r   r   r   r   rm  z:TestUpdateWrapper.test_missing_attributes.<locals>.wrapper  r}  r   r   r  r   r9   )r  r
   r~  r  r"   rO   rY   r   r  s        r   test_missing_attributesz)TestUpdateWrapper.test_missing_attributes  s   	 	 		 	 	 !VV<<<!1222*B///~.. 	A 	A$Wa@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A~.. 	A 	A$Wa@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	As$   ;BB#&B#C00C47C4c                    d }t          j        |t                     |                     |j        d           |                     |j                            d                     |                     |j        i            d S )Nc                      d S r   r   r   r   r   rm  z6TestUpdateWrapper.test_builtin_update.<locals>.wrapper  r}  r   r   zmax()	r
   r~  r   rO   r(   rM   r  
startswithr  )r1   rm  s     r   test_builtin_updatez%TestUpdateWrapper.test_builtin_update  s~    
	 	 	 #...)5111226::;;;0"55555r   N)r(   r)   r*   r
   WRAPPER_ASSIGNMENTSWRAPPER_UPDATESrs  r  r  unittestskipIfr   flagsoptimizer  r  r  r  r   requires_docstringsr  r   r   r   rj  rj  W  s         )<'74 4 4 4&	 	 	7 7 7 X_SY'1,@B B< <B B<3 3 39 9 9$A A A(  X_SY'1,@B B6 6B B ! 6 6 6r   rj  c                   v    e Zd Zd Zd Z ej        ej        j	        dk    d          d             Z
d Zd ZdS )		TestWrapsc                 f    d }d|_         d|_        t          j        |          d             }||fS )Nc                      dS rw  r   r   r   r   r   z$TestWraps._default_update.<locals>.f  ry  r   rz  zThis is still a bald faced liec                      d S r   r   r   r   r   rm  z*TestWraps._default_update.<locals>.wrapper  ry  r   )r   rl  r
   wrapsr  s      r   r  zTestWraps._default_update  sO    	 	 	 '8				 	 
		zr   c                    |                                  \  }}|                     ||           |                     |j        d           |                     |j        |j                   |                     |j        d           d S )Nr   rz  )r  rs  rO   r(   r*   r   r  s      r   r  zTestWraps.test_default_update  s    ))++
7A&&&)3///-q~>>>'<=====r   r:   r  c                 j    |                                  \  }}|                     |j        d           d S r  r  )r1   rm  _s      r   r  z!TestWraps.test_default_update_doc  r  r   c                 z   d }d|_         t          j        |dd          d             }|                     ||dd           |                     |j        d           |                     |j        |j                   |                     |j        d            | 	                    t          |d                     d S )Nc                      dS rw  r   r   r   r   r   z#TestWraps.test_no_update.<locals>.f  ry  r   rz  r   c                      d S r   r   r   r   r   rm  z)TestWraps.test_no_update.<locals>.wrapper  ry  r   rm  r   )r   r
   r  rs  rO   r(   r  r*   r  rC  rD  r  s      r   r  zTestWraps.test_no_update  s    	 	 	 '	B	#	#	 	 
$	#	7Ar2...)9555G0!.AAA$///&1122222r   c                    d }d|_         t          ddd          |_        d }d}d	}t          j        |||          |d
                         }|                     ||||           |                     |j        d           |                     |j	        |j	                   |                     |j
        d            |                     |j         d           |                     |j        |j                   d S )Nc                      d S r   r   r   r   r   r   z*TestWraps.test_selective_update.<locals>.f  r}  r   r  r9   r:   r@   rG   c                     i | _         | S r   r  )r   s    r   add_dict_attrz6TestWraps.test_selective_update.<locals>.add_dict_attr  s    AKHr   r   r  c                      d S r   r   r   r   r   rm  z0TestWraps.test_selective_update.<locals>.wrapper  s	     Dr   rm  )r   rP   r  r
   r  rs  rO   r(   r  r*   r  )r1   r   r  r  r  rm  s         r   r  zTestWraps.test_selective_update  s   	 	 	+Q!q)))	 	 	 	FF	+	+		 	 
 
,	+	7Avv666)9555G0!.AAA$///'ABBB*AK88888r   N)r(   r)   r*   r  r  r  r  r   r  r  r  r  r  r   r   r   r  r    s        	 	 	> > > X_SY'1,@B B< <B B<3 3 39 9 9 9 9r   r  c                       e Zd Zd Zd ZdS )
TestReducec           	      n    G d d          }d }|                      |                     |g dd          d           |                      |                     |ddgg d	d
ggg           g d           |                      |                     d t          dd          d          d           |                      |                     d t          dd          d          d           |                      |                     | |d                    d           |                      |                     | |d          d          d           |                      |                     | |d          d          d           |                     t          | j                   |                     t          | j        dd           |                     t          | j        ddd           |                      |                     dd          d           |                      |                     ddd          d           |                     t          | j        dd           |                     t          | j        |g            |                     t          | j        |d           |                     t          | j        |d           |                     t          | j        |t                                  G d d          }|                     t          | j        | |                       |                      |                     |g d           d            |                      |                     |g d          d            G d d          }|                     t          | j        d |                       d S )Nc                        e Zd Zd Zd Zd ZdS )'TestReduce.test_reduce.<locals>.Squaresc                 "    || _         g | _        d S r   )r   sofar)r1   r   s     r   r  z0TestReduce.test_reduce.<locals>.Squares.__init__
  s    


r   c                 *    t          | j                  S r   )lenr  r\   s    r   r   z/TestReduce.test_reduce.<locals>.Squares.__len__  s    4:&r   c                     d|cxk    r| j         k     s	n t          t          | j                  }||k    r(| j                            ||z             |dz  }||k    (| j        |         S )Nr   r9   )r   r   r  r  append)r1   ins      r   r   z3TestReduce.test_reduce.<locals>.Squares.__getitem__  sz    A((((((((
*:
OO1ffJ%%ac***FA 1ff z!}$r   N)r(   r)   r*   r  r   r   r   r   r   Squaresr  	  sA             ' ' '% % % % %r   r  c                     | |z   S r   r   r   s     r   r]  z#TestReduce.test_reduce.<locals>.add  rg  r   rG   r   r^  r>   rE   rd   w)r>   rE   rd   r  c                     | |z  S r   r   r   s     r   rK   z(TestReduce.test_reduce.<locals>.<lambda>  s
    !A# r   r:   r)  r9   i  c                     | |z  S r   r   r   s     r   rK   z(TestReduce.test_reduce.<locals>.<lambda>!  s
    QqS r      l     h r;   i  r   *   1)r  r  r   c                       e Zd Zd ZdS )/TestReduce.test_reduce.<locals>.TestFailingIterc                     t           r   RuntimeErrorr\   s    r   __iter__z8TestReduce.test_reduce.<locals>.TestFailingIter.__iter__3  s    ""r   N)r(   r)   r*   r  r   r   r   TestFailingIterr  2  s#        # # # # #r   r  c                       e Zd Zd ZdS )&TestReduce.test_reduce.<locals>.BadSeqc                     t           r   )
ValueError)r1   indexs     r   r   z2TestReduce.test_reduce.<locals>.BadSeq.__getitem__;  s      r   N)r(   r)   r*   r   r   r   r   BadSeqr  :  s#        ! ! ! ! !r   r  )rO   reducer   rY   rZ   r   r  r  )r1   r  r]  r  r  s        r   test_reducezTestReduce.test_reduce  s   	% 	% 	% 	% 	% 	% 	% 	%	 	 	S///2>>FFFKKsCj"sCj92>>	
 	
 	
 	%5%5uQqzz1EEtLLLKK((%"++q99	
 	
 	
 	S''"++66<<<S''"++q993???S''!**a88!<<<)T[111)T["b999)T["b"===R--s333RS113777)T["h???)T[#r:::)T[#r:::)T[#r:::)T[#vxx@@@	# 	# 	# 	# 	# 	# 	# 	# 	,S//:K:KLLLS"d33T:::S"b112666	! 	! 	! 	! 	! 	! 	! 	! 	*dk2vvxx@@@@@r   c                 0    G d d          }ddl m} |                     |                     | |d                    d           |                     |                     | |d          d          d           |                     t
          | j        | |d                     |                     |                     | |d          d          d           |                     |                     | |d	                    d           |                     |                     | |d	          d          d           d	d
dd}|                     |                     ||          d                    |                                                     d S )Nc                       e Zd Zd Zd ZdS )5TestReduce.test_iterator_usage.<locals>.SequenceClassc                     || _         d S r   r  )r1   r  s     r   r  z>TestReduce.test_iterator_usage.<locals>.SequenceClass.__init__B      r   c                 >    d|cxk    r| j         k     rn n|S t          Nr   )r  r   )r1   r  s     r   r   zATestReduce.test_iterator_usage.<locals>.SequenceClass.__getitem__D  s(    ????DF?????H$$r   N)r(   r)   r*   r  r   r   r   r   SequenceClassr  A  s2          % % % % %r   r  r   )r]  r`   r;   r  4   r9   r:   r@   )onetwothreer   )operatorr]  rO   r  rY   rZ   r   keys)r1   r  r]  rd   s       r   test_iterator_usagezTestReduce.test_iterator_usage@  s   	% 	% 	% 	% 	% 	% 	% 	% 	!     S--*:*:;;R@@@S--*:*:B??DDD)T[#}}Q7G7GHHHS--*:*:B??DDDS--*:*:;;Q???S--*:*:B??DDDa!,,S!,,bggaffhh.?.?@@@@@r   N)r(   r)   r*   r  r  r   r   r   r  r    s;        5A 5A 5ApA A A A Ar   r  c                   $    e Zd Zer	ej        ZdS dS )TestReduceCN)r(   r)   r*   r   r  r   r   r   r  r  V  s(         $#$ $r   r  c                   .    e Zd Z eej                  ZdS )TestReducePyN)r(   r)   r*   r2  r   r  r   r   r   r  r  \  s         \,-..FFFr   r  c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TestCmpToKeyc                    d }|                      |          }|                      |d           |d                     |                      |d           |d                     |                      |d           |d                     d }|                      |          }|                      |d           |d                     |                      |d           |d                     |                      |d           |d                     |                      |d           |d                     d S )	Nc                     | |k    | |k     z
  S r   r   r   s     r   cmp1z*TestCmpToKey.test_cmp_to_key.<locals>.cmp1c      Ea!e$$r   r@   r9   c                 @    t          |           t          |          z
  S r   r   r   s     r   cmp2z*TestCmpToKey.test_cmp_to_key.<locals>.cmp2j  s    q66CFF?"r   g      @4r:   35)
cmp_to_keyrO   assertGreaterassertGreaterEqual
assertLessassertLessEqualr  )r1   r  r   r  s       r   test_cmp_to_keyzTestCmpToKey.test_cmp_to_keyb  sP   	% 	% 	%ood##QQ(((33q6633q66***AA///	# 	# 	#ood##S33s88,,,AD		***SSVVSSYY///CCFFCCII.....r   c                 <   d }|                      |          }|                      |d           |d                     |                      |d           |d                     |                     t          t
          f          5   |d          dk     d d d            n# 1 swxY w Y   |                     t          t
          f          5  d |d          k      d d d            n# 1 swxY w Y   |                     t                    5  |                                  }d d d            n# 1 swxY w Y   |                     t                    5  |                      |d           }d d d            n# 1 swxY w Y   |                      |          }|                     t                    5   |             d d d            n# 1 swxY w Y   |                     t                    5   |d d            d d d            d S # 1 swxY w Y   d S )Nc                     | |k    | |k     z
  S r   r   r   s     r   r  z4TestCmpToKey.test_cmp_to_key_arguments.<locals>.cmp1s  r  r   mycmpr@   rG  r9   )r  rO   r   rY   rZ   r   r1   r  r   s      r   test_cmp_to_key_argumentsz&TestCmpToKey.test_cmp_to_key_argumentsr  sv   	% 	% 	%ooDo))SSQZZZ000331:::ssqzzz222	>:;; 	 	CFFQJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 		>:;; 	 	AJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	$ 	$//##C	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$y)) 	. 	.//$--C	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.ood##y)) 	 	CEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	y)) 	 	CdOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sl   B++B/2B/C33C7:C7D99D= D=FFF;GGG7HHHc                    d }|                      |          }|                     t                    5   |d           |d          k     d d d            n# 1 swxY w Y    G d d          fd}|                     t                    5   |d           |d          k     d d d            d S # 1 swxY w Y   d S )Nc                     t           r   r   r   s     r   r  z'TestCmpToKey.test_bad_cmp.<locals>.cmp1  s    ##r   r@   r9   c                       e Zd Zd ZdS ))TestCmpToKey.test_bad_cmp.<locals>.BadCmpc                     t           r   r  r0   s     r   __lt__z0TestCmpToKey.test_bad_cmp.<locals>.BadCmp.__lt__  s    ''r   N)r(   r)   r*   r  r   r   r   BadCmpr    s#        ( ( ( ( (r   r  c                                  S r   r   )rJ   r   r  s     r   r  z'TestCmpToKey.test_bad_cmp.<locals>.cmp1  s    688Or   )r  rY   r   )r1   r  r   r  s      @r   test_bad_cmpzTestCmpToKey.test_bad_cmp  sy   	$ 	$ 	$ood##011 	 	CFFSSVVOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 		( 	( 	( 	( 	( 	( 	( 	(	 	 	 	 	011 	 	CFFSSVVOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AA AB66B:=B:c                     d }|                      |          }|                      |d          j        d           d S )Nc                     | |k    | |k     z
  S r   r   r   s     r   r  z)TestCmpToKey.test_obj_field.<locals>.cmp1  r  r   r  2   )r  rO   r@  r	  s      r   test_obj_fieldzTestCmpToKey.test_obj_field  sJ    	% 	% 	%ooDo))Rb)))))r   c                     d }|                      t          t          d          |                     |                    g d           d S )Nc                     || z
  S r   r   r   s     r   r  z)TestCmpToKey.test_sort_int.<locals>.mycmp  rg  r   r`   r   )rA   r@   r:   r9   r   )rO   sortedr   r  )r1   r  s     r   test_sort_intzTestCmpToKey.test_sort_int  s[    	 	 	adooe.D.DEEE(	* 	* 	* 	* 	*r   c                     d }g d}t          ||                     |                    }|                     d |D             g d           d S )Nc                 X    t          |           t          |          }} | |k    | |k     z
  S r   r  r   s     r   r  z-TestCmpToKey.test_sort_int_str.<locals>.mycmp  s*    q663q66qAEa!e$$r   )	r`   3rb   r:   0r  rA   10r9   r  c                 ,    g | ]}t          |          S r   r  )r   r   s     r   r   z2TestCmpToKey.test_sort_int_str.<locals>.<listcomp>  s    999#e**999r   )	r   r9   r9   r:   r@   rA   r`   rb   r;   )r  r  rO   )r1   r  valuess      r   test_sort_int_strzTestCmpToKey.test_sort_int_str  sx    	% 	% 	% 655DOOE$:$:;;;99&999555	7 	7 	7 	7 	7r   c                     d }|                      |          } |d          }|                     t          t          |           |                     |t
          j        j                   d S )Nc                     || z
  S r   r   r   s     r   r  z%TestCmpToKey.test_hash.<locals>.mycmp  rg  r   r;   )r  rY   rZ   hashassertNotIsInstancecollectionsr^  Hashable)r1   r  r   ks       r   	test_hashzTestCmpToKey.test_hash  sh    	 	 	ooe$$CGG)T1---  KO$<=====r   N)
r(   r)   r*   r  r
  r  r  r  r%  r-  r   r   r   r  r  `  s}        / / /   (  * * ** * *7 7 7> > > > >r   r  c                   @    e Zd Zerej        Zej        d             ZdS )TestCmpToKeyCc                 z    t          j        | t          t                              d                                d S r   )r   check_disallow_instantiationr   r   r  r\   s    r   test_disallow_instantiationz)TestCmpToKeyC.test_disallow_instantiation  s>     	,${--d3344	
 	
 	
 	
 	
r   N)r(   r)   r*   r   r  r   cpython_onlyr2  r   r   r   r/  r/    sA         , +

 
 
 
 
r   r/  c                   .    e Zd Z eej                  ZdS )TestCmpToKeyPyN)r(   r)   r*   r2  r   r  r   r   r   r5  r5    s         l566JJJr   r5  c                   J    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S )TestTotalOrderingc                    t           j         G d d                      }|                      |d           |d          k                |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               d S )Nc                        e Zd Zd Zd Zd ZdS )3TestTotalOrdering.test_total_ordering_lt.<locals>.Ac                     || _         d S r   r   r1   r   s     r   r  z<TestTotalOrdering.test_total_ordering_lt.<locals>.A.__init__      "


r   c                 "    | j         |j         k     S r   r<  r0   s     r   r  z:TestTotalOrdering.test_total_ordering_lt.<locals>.A.__lt__      zEK//r   c                 "    | j         |j         k    S r   r<  r0   s     r   __eq__z:TestTotalOrdering.test_total_ordering_lt.<locals>.A.__eq__      zU[00r   Nr(   r)   r*   r  r  rB  r   r   r   r6  r:    A        # # #0 0 01 1 1 1 1r   r6  r9   r:   r
   total_orderingrM   rC  r1   r6  s     r   test_total_ordering_ltz(TestTotalOrdering.test_total_ordering_lt  L   		!	1 	1 	1 	1 	1 	1 	1 
"	!	1 	!qqtt$$$!qqtt$$$!!%%%!!%%%!!%%%!!%%%1!%%%%%r   c                    t           j         G d d                      }|                      |d           |d          k                |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               d S )Nc                        e Zd Zd Zd Zd ZdS )3TestTotalOrdering.test_total_ordering_le.<locals>.Ac                     || _         d S r   r<  r=  s     r   r  z<TestTotalOrdering.test_total_ordering_le.<locals>.A.__init__  r>  r   c                 "    | j         |j         k    S r   r<  r0   s     r   __le__z:TestTotalOrdering.test_total_ordering_le.<locals>.A.__le__  rC  r   c                 "    | j         |j         k    S r   r<  r0   s     r   rB  z:TestTotalOrdering.test_total_ordering_le.<locals>.A.__eq__  rC  r   N)r(   r)   r*   r  rP  rB  r   r   r   r6  rM    A        # # #1 1 11 1 1 1 1r   r6  r9   r:   rF  rH  s     r   test_total_ordering_lez(TestTotalOrdering.test_total_ordering_le  L   		!	1 	1 	1 	1 	1 	1 	1 
"	!	1 	!qqtt$$$!qqtt$$$!!%%%!!%%%!!%%%!!%%%11&&&&&r   c                    t           j         G d d                      }|                      |d           |d          k                |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k                d S )Nc                        e Zd Zd Zd Zd ZdS )3TestTotalOrdering.test_total_ordering_gt.<locals>.Ac                     || _         d S r   r<  r=  s     r   r  z<TestTotalOrdering.test_total_ordering_gt.<locals>.A.__init__  r>  r   c                 "    | j         |j         k    S r   r<  r0   s     r   __gt__z:TestTotalOrdering.test_total_ordering_gt.<locals>.A.__gt__  r@  r   c                 "    | j         |j         k    S r   r<  r0   s     r   rB  z:TestTotalOrdering.test_total_ordering_gt.<locals>.A.__eq__  rC  r   N)r(   r)   r*   r  rZ  rB  r   r   r   r6  rW    rE  r   r6  r9   r:   rF  rH  s     r   test_total_ordering_gtz(TestTotalOrdering.test_total_ordering_gt  rJ  r   c                    t           j         G d d                      }|                      |d           |d          k                |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               d S )Nc                        e Zd Zd Zd Zd ZdS )3TestTotalOrdering.test_total_ordering_ge.<locals>.Ac                     || _         d S r   r<  r=  s     r   r  z<TestTotalOrdering.test_total_ordering_ge.<locals>.A.__init__  r>  r   c                 "    | j         |j         k    S r   r<  r0   s     r   __ge__z:TestTotalOrdering.test_total_ordering_ge.<locals>.A.__ge__  rC  r   c                 "    | j         |j         k    S r   r<  r0   s     r   rB  z:TestTotalOrdering.test_total_ordering_ge.<locals>.A.__eq__   rC  r   N)r(   r)   r*   r  rb  rB  r   r   r   r6  r_    rR  r   r6  r9   r:   rF  rH  s     r   test_total_ordering_gez(TestTotalOrdering.test_total_ordering_ge  rT  r   c                 T   t           j         G d dt                                }|                      |d           |d          k                |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               |                      |d           |d          k               d S )Nc                       e Zd ZdS )=TestTotalOrdering.test_total_ordering_no_overwrite.<locals>.ANr'   r   r   r   r6  rg            Dr   r6  r9   r:   )r
   rG  r   rM   rH  s     r    test_total_ordering_no_overwritez2TestTotalOrdering.test_total_ordering_no_overwrite
  s$   		!	 	 	 	 	 	 	 
"	!	!qqtt$$$!qqtt$$$!!%%%!!%%%!!%%%!!%%%%%r   c                     |                      t                    5  t          j         G d d                      }d d d            d S # 1 swxY w Y   d S )Nc                       e Zd ZdS )7TestTotalOrdering.test_no_operations_defined.<locals>.ANr'   r   r   r   r6  rl    s        r   r6  )rY   r  r
   rG  rH  s     r   test_no_operations_definedz,TestTotalOrdering.test_no_operations_defined  s    z** 	 	%       &%	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s    AAAc                 >   t           j         G fdd                      t           j         G fdd                      t           j         G fdd                      t           j         G fdd                      |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     |                      d	                              d	          t                     d S )
Nc                   *    e Zd Zd Z fdZ fdZdS )ATestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThanc                     || _         d S r   r<  r=  s     r   r  zJTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThan.__init__   r>  r   c                 H    t          |          r| j        |j        k    S dS r   
isinstancer   r1   r2   ImplementsLessThans     r   rB  zHTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThan.__eq__"  *    e%788 5:44ur   c                 R    t          |          r| j        |j        k     S t          S r   rt  r   NotImplementedru  s     r   r  zHTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThan.__lt__&  +    e%788 4:33%%r   Nr(   r)   r*   r  rB  r  rv  s   r   rv  rp    V        # # #    & & & & & & &r   rv  c                   *    e Zd Zd Z fdZ fdZdS )HTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThanEqualToc                     || _         d S r   r<  r=  s     r   r  zQTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThanEqualTo.__init__-  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r1   r2   ImplementsLessThanEqualTos     r   rB  zOTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThanEqualTo.__eq__/  *    e%>?? 5:44ur   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rP  zOTestTotalOrdering.test_notimplemented.<locals>.ImplementsLessThanEqualTo.__le__3  +    e%>?? 5:44%%r   Nr(   r)   r*   r  rB  rP  r  s   r   r  r  +  r~  r   r  c                   *    e Zd Zd Z fdZ fdZdS )DTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThanc                     || _         d S r   r<  r=  s     r   r  zMTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThan.__init__:  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r1   r2   ImplementsGreaterThans     r   rB  zKTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThan.__eq__<  *    e%:;; 5:44ur   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rZ  zKTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThan.__gt__@  +    e%:;; 4:33%%r   Nr(   r)   r*   r  rB  rZ  r  s   r   r  r  8  r~  r   r  c                   *    e Zd Zd Z fdZ fdZdS )KTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThanEqualToc                     || _         d S r   r<  r=  s     r   r  zTTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThanEqualTo.__init__G  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r1   r2   ImplementsGreaterThanEqualTos     r   rB  zRTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThanEqualTo.__eq__I  *    e%ABB 5:44ur   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rb  zRTestTotalOrdering.test_notimplemented.<locals>.ImplementsGreaterThanEqualTo.__ge__M  +    e%ABB 5:44%%r   Nr(   r)   r*   r  rB  rb  r  s   r   r  r  E  r~  r   r  r9   )r
   rG  r   rP  rz  rZ  rb  r  )r1   r  r  rv  r  s    @@@@r   test_notimplementedz%TestTotalOrdering.test_notimplemented  s<   		!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 	((++22155~FFF((++22155~FFF((++22155~FFF//2299!<<nMMM//2299!<<nMMM//2299!<<nMMM++A..55a88.III++A..55a88.III++A..55a88.III22155<<Q??PPP22155<<Q??PPP22155<<Q??PPPPPr   c                    t           j         G fdd                      t           j         G fdd                      t           j         G fdd                      t           j         G fdd                      t           j         G fd	d
                      |                     d          5  |                     t                    5   d          dk      d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k      d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k      d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5  |                     t                    5   d           d          k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5   d          } d          }|                     ||           |                     t                    5  ||k     d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                     d          5   d           } d           }|                     ||           |                     t                    5  ||k     d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )!Nc                   *    e Zd Zd Z fdZ fdZdS )RTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThanc                     || _         d S r   r<  r=  s     r   r  z[TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThan.__init__d  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  ru  s     r   rB  zYTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThan.__eq__f  rw  r   c                 R    t          |          r| j        |j        k     S t          S r   ry  ru  s     r   r  zYTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThan.__lt__j  r{  r   Nr|  r}  s   r   rv  r  b  r~  r   rv  c                   *    e Zd Zd Z fdZ fdZdS )UTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThanc                     || _         d S r   r<  r=  s     r   r  z^TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThan.__init__q  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r  s     r   rB  z\TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThan.__eq__s  r  r   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rZ  z\TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThan.__gt__w  r  r   Nr  r  s   r   r  r  o  r~  r   r  c                   *    e Zd Zd Z fdZ fdZdS )YTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThanEqualToc                     || _         d S r   r<  r=  s     r   r  zbTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThanEqualTo.__init__~  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r  s     r   rB  z`TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThanEqualTo.__eq__  r  r   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rP  z`TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsLessThanEqualTo.__le__  r  r   Nr  r  s   r   r  r  |  r~  r   r  c                   *    e Zd Zd Z fdZ fdZdS )\TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThanEqualToc                     || _         d S r   r<  r=  s     r   r  zeTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThanEqualTo.__init__  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  r  s     r   rB  zcTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThanEqualTo.__eq__  r  r   c                 R    t          |          r| j        |j        k    S t          S r   ry  r  s     r   rb  zcTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ImplementsGreaterThanEqualTo.__ge__  r  r   Nr  r  s   r   r  r    r~  r   r  c                   &    e Zd Zd Z fdZd ZdS )XTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ComparatorNotImplementedc                     || _         d S r   r<  r=  s     r   r  zaTestTotalOrdering.test_type_error_when_not_implemented.<locals>.ComparatorNotImplemented.__init__  r>  r   c                 H    t          |          r| j        |j        k    S dS r   rs  )r1   r2   ComparatorNotImplementeds     r   rB  z_TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ComparatorNotImplemented.__eq__  s*    e%=>> 5:44ur   c                     t           S r   )rz  r0   s     r   r  z_TestTotalOrdering.test_type_error_when_not_implemented.<locals>.ComparatorNotImplemented.__lt__  s    %%r   Nr|  )r  s   r   r  r    sL        # # #    & & & & &r   r  zLT < 1r9   zLT < LEr   zLT < GTzLE <= LTr:   zLE <= GEr@   zGT > GErA   zGT > LTr`   zGE >= GTr'  zGE >= LErb   zGE when equalr)  zLE when equalr*  )r
   rG  rH  rY   rZ   rO   )r1   r>   r?   r  r  r  rv  r  s      @@@@@r   $test_type_error_when_not_implementedz6TestTotalOrdering.test_type_error_when_not_implemented_  s    
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
	& 
"	!
	& 
	!	& 	& 	& 	& 	& 	& 	& 	& 	& 
"	!	& \\(## 	' 	'T%6%6y%A%A 	' 	'r""Q&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' \\)$$ 	A 	Ad&7&7	&B&B 	A 	Aq!!$=$=a$@$@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A \\)$$ 	= 	=d&7&7	&B&B 	= 	=q!!$9$9!$<$<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= \\*%% 	B 	Bt'8'8'C'C 	B 	B%%a((,>,>q,A,AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B \\*%% 	L 	Lt'8'8'C'C 	L 	L%%a((,H,H,K,KKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L \\)$$ 	G 	Gd&7&7	&B&B 	G 	G!!!$$'C'CA'F'FFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G \\)$$ 	= 	=d&7&7	&B&B 	= 	=!!!$$'9'9!'<'<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= \\*%% 	H 	Ht'8'8'C'C 	H 	H((++/D/DQ/G/GGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H \\*%% 	L 	Lt'8'8'C'C 	L 	L((++/H/H/K/KKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L \\/** 	 	((++A((++AQ"""""9--  Q              		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 \\/** 	 	((++A((++AQ"""""9--  Q              		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sT   DC7+D7C;	;D>C;	?DDD.F	E."F.E2	2F5E2	6FF	F	%G< G%G<%G)	)G<,G)	-G<<H H I37II3I 	 I3#I 	$I33I7:I7K*.KK*K	K*K	K**K.1K.
M!%M
>M!
M	M!M	M!!M%(M%OO5OO	OO		OOO8QP8,Q8P<	<Q?P<	 QQQ/S
R/#S/R3	3S6R3	7SS
S
&AU-U 4U U	UU	UUU7AW)>WW)W	W)W	W))W-0W-c           	      P   t          t          j        dz             D ]}dD ]}|                     ||          5  t	          t
          |          }t          j        t          j        ||                    }|                     ||           d d d            n# 1 swxY w Y   d S )Nr9   )r  rZ  rP  rb  )rP  r   )	r   r   r   rH  r   Orderable_LTr   r   r   )r1   r   r   rP  method_copys        r   r   zTestTotalOrdering.test_pickle  s    62Q677 	7 	7E> 7 7\\U\;; 7 7$\488F"(,v|FE/J/J"K"KKMM+v6667 7 7 7 7 7 7 7 7 7 7 7 7 7 77	7 	7s   ABB Bc                     t           j         G fddt                                 G d d          } G d d          }|                     ||k                |                     ||k               d S )Nc                   4     e Zd Z fdZfdZfdZ xZS )WTestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.SortableMetac                 L    t                                          | |||          S r   )super__new__)r5  r   basesns	__class__s       r   r  z_TestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.SortableMeta.__new__  s    wwsD%<<<r   c                 F    t          |          s	 | j        |j        k     S r   rt  r(   r1   r2   SortableMetas     r   r  z^TestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.SortableMeta.__lt__  s'    !%66 }u~55r   c                 F    t          |          s	 | j        |j        k    S r   r  r  s     r   rB  z^TestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.SortableMeta.__eq__  s'    !%66 }66r   )r(   r)   r*   r  r  rB  __classcell__)r  r  s   @r   r  r    sk        = = = = =6 6 6 6 6
7 7 7 7 7 7 7 7 7r   r  c                       e Zd ZdS )LTestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.BNr'   r   r   r   rQ  r            Dr   rQ  	metaclassc                       e Zd ZdS )LTestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605.<locals>.ANr'   r   r   r   r6  r    r  r   r6  )r
   rG  r   rM   rC  )r1   rQ  r6  r  s      @r   /test_total_ordering_for_metaclasses_issue_44605zATestTotalOrdering.test_total_ordering_for_metaclasses_issue_44605  s    		!	7 	7 	7 	7 	7 	7 	74 	7 	7 
"	!	7	 	 	 	 	, 	 	 	 		 	 	 	 	, 	 	 	 	 	AQr   N)r(   r)   r*   rI  rS  r\  rd  ri  rm  r  r  r   r  r   r   r   r7  r7    s        & & &"' ' '"& & &"' ' '"
& 
& 
&  AQ AQ AQFi i iV7 7 7         r   r7  c                        e Zd Zd Zd Zd ZdS )r  c                     || _         d S r   r<  r=  s     r   r  zOrderable_LT.__init__  s    


r   c                 "    | j         |j         k     S r   r<  r0   s     r   r  zOrderable_LT.__lt__  s    zEK''r   c                 "    | j         |j         k    S r   r<  r0   s     r   rB  zOrderable_LT.__eq__  s    zU[((r   NrD  r   r   r   r  r    sA          ( ( () ) ) ) )r   r  c                       e Zd Zd ZdS )	TestCachec           	         | j         j        fd            |                     fdt          d          D             g d           |                                                     | j                             ddd d                                                      |                                                     | j                             ddd d                     d S )Nc                 N    | dk     r| S  | dz
             | dz
            z   S Nr:   r9   r   r  fibs    r   r  z!TestCache.test_cache.<locals>.fib  4    1uu3qs88cc!A#hh&&r   c                 &    g | ]} |          S r   r   r   r  r  s     r   r   z(TestCache.test_cache.<locals>.<listcomp>  !    444Q##a&&444r   r   r   r9   r9   r:   r@   r`   r)     r  "   7   Y         iy  ib     hitsmissesmaxsizecurrsizer   )modulecacherO   r   
cache_info
_CacheInfocache_clearr1   r  s    @r   
test_cachezTestCache.test_cache  s   			' 	' 	' 	' 
		' 	4444%))444III	K 	K 	K))K""2tb"QQ	S 	S 	S))K""!TA"NN	P 	P 	P 	P 	Pr   N)r(   r)   r*   r  r   r   r   r  r    s(        P P P P Pr   r  c                   .   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 ej                    d             Z ej                    d             Z ej                    d             Zd Zd Zd Zd Zd Zd Zd ZdS )TestLRUc                 D   d } | j                             d          |          }|                                \  }}}}|                     |d           |                     |d           |                     |d           |                     |d           t	          d          }t	          d          D ]N}t          |          t          |          }
}	 ||	|
          } ||	|
          }|                     ||           O|                                \  }}}}|                     ||k               |                     ||z   d           |                     |d           |                                 |                                \  }}}}|                     |d           |                     |d           |                     |d            ||	|
           |                                \  }}}}|                     |d           |                     |d           |                     |d           |                     |j	        |           |	                    |	|
           |                                \  }}}}|                     |d           |                     |d           |                     |d           | j                             d          fd            }|                     |                                j
        d           dt	          d          D ] }|                      |            d           !|                     d           |                                \  }}}}|                     |d           |                     |d           |                     |d           | j                             d          fd	            }|                     |                                j
        d           dt	          d          D ] }|                      |            d           !|                     d           |                                \  }}}}|                     |d
           |                     |d           |                     |d           | j                             d          fd            }|                     |                                j
        d           ddD ]$}	|                      ||	          |	dz             %|                     d
           |                                \  }}}}|                     |d           |                     |d
           |                     |d           d S )Nc                     d| z  |z   S Nr@   r   r   s     r   origzTestLRU.test_lru.<locals>.orig      q519r   r<   r  r   r`     r9   c                       dz   dS Nr9   r<   r   f_cnts   r   r   zTestLRU.test_lru.<locals>.f6       QJE2r   c                       dz   dS r  r   r  s   r   r   zTestLRU.test_lru.<locals>.fF  r  r   rA   r:   c                     dz  | dz  S Nr9   r;   r   )rJ   r  s    r   r   zTestLRU.test_lru.<locals>.fV  s     QJER4Kr   )rb   r*  rb   r*  rb   r*  r)  r)  r)  r*  r*  r*  r)  r)  r)  rb   r;      )r  	lru_cacher  rO   r   r   rM   r  r   rl  r  )r1   r   r   r  r  r  r  domainr  rJ   r   actualrq   r  s                @r   test_lruzTestLRU.test_lru  s   	 	 	-DK!!"!--d33*+,,..'fgx"%%%1%%%q!!!###qt 	/ 	/A&>>6&>>qAQq!WWFtAqzzHVX....*+,,..'fgxv&&&---2&&&	*+,,..'fgxq!!!###1%%%	!Q*+,,..'fgxq!!!###1%%% 	amT***	a*+,,..'fgxq!!!###1%%% 
		q	!	!	 	 	 	 
"	!	 	/333q 	& 	&AQQSS"%%%%"""*+,,..'fgxq!!!###1%%% 
		q	!	!	 	 	 	 
"	!	 	/333q 	& 	&AQQSS"%%%%"""*+,,..'fgxq!!!###1%%% 
		q	!	!	 	 	 	 
"	!	 	/333? 	) 	)AQQqTT1R4(((("""*+,,..'fgxr"""###1%%%%%r   c           	         | j         j        d             }|                     t          t	          |g d                    g d           |                     |                                j        d           |                     |                                j        d           |                     |                                j        d           |                     |                                j	        d           d S )Nc                     | dz  S Nr:   r   rI   s    r   squarez(TestLRU.test_lru_no_args.<locals>.squareg  s    6Mr   )r;   r<   r;   )d   i  r  r9   r:      )
r  r  rO   r/   rQ   r  r  r  r  r  )r1   r  s     r   test_lru_no_argszTestLRU.test_lru_no_argsf  s    			 	 
		 	c&,,,7788(	* 	* 	***,,11555**,,3Q777**,,4c:::**,,5q99999r   c                    d| j                             d          fd            t          d          D ]%}|                      |          d| d           &|                                                     j        d           |                      d          d           |                                                     j        d           d S )	NTr;   r  c                 >    d|  d}| dk    rrd |           }|S )N.r<   Fr   )rJ   rvr   onces     r   r   z%TestLRU.test_lru_bug_35780.<locals>.f{  s6     QBBww4wQqTTIr      r  r<   z.20.)r  r  r   rO   r  r  )r1   rJ   r   r  s     @@r   test_lru_bug_35780zTestLRU.test_lru_bug_35780r  s     			r		*	*	 	 	 	 	 
+	*	 r 	- 	-AQQqTT8q888,,,,0"555 	2'''0"55555r   c                     | j                                         d             } |d            |di i  |                     |                                j        d           d S )Nc                     d S r   r   rI   s    r   r   z%TestLRU.test_lru_bug_36650.<locals>.f  ry  r   r   r9   rn   )r  r  rO   r  r  r   s     r   test_lru_bug_36650zTestLRU.test_lru_bug_36650  ss     
			 	 	 	 
!	 	 	
!	

r


,a00000r   c                 ^   | j                             d          d             }t          j                                        }t          j                            d          |_        t          j                            d          |_        |                      ||d          d           |                     |j        j        d           |                     |	                                d           |                      ||d          d           |                     |j        j        d	           |                     |	                                d
           |                      |dd	          d           |                     |j        j        d	           |                     |	                                d           |                      ||d          d           |                     |j        j        d           |                     |	                                d           d S )Nr9   r  c                     | dz  |z   S r  r   r   s     r   r   z*TestLRU.test_lru_hash_only_once.<locals>.f  s    q519r   r  )return_valuei  r   )r   r9   r9   r9   r:   )r9   r9   r9   r9   r'  r<   )r9   r:   r9   r9   r@   )r9   r@   r9   r9   )
r  r  r  mockMock__mul____hash__rO   
call_countr  )r1   r   mock_ints      r   test_lru_hash_only_oncezTestLRU.test_lru_hash_only_once  s    
		q		)	)	 	 
*	)	 =%%''#=--2->>$M..C.@@ 	8Q,,,*5q999666 	8Q,,,*5q999666 	1a"%%%*5q999666 	8Q,,,*5q99966666r   c                     t           j        }	  | j                            d          t                    t           _        dD ]-}|                     t          dd |                   |           .	 |t           _        d S # |t           _        w xY w)NrA   )r   r   r9   r:   r@   r@   rA   r`   r'  r9   rb   r:   r9   abcdefghijklmn)builtinsr  r  r  rO   )r1   old_lenr  s      r   test_lru_reentrancy_with_lenz$TestLRU.test_lru_reentrancy_with_len  s     ,	#34;0033C88HL< ? ?  %5bqb%9!:!:A>>>>? #HLLL7HL""""s   A"A? ?Bc                     | j                                         d             }|                      |dd          d           |                      |d          d           d S )Nc                      | S r   r   r   s    r   r   z-TestLRU.test_lru_star_arg_handling.<locals>.f  s    Kr   r9   r:   rV   )rV   r  r  rO   r   s     r   test_lru_star_arg_handlingz"TestLRU.test_lru_star_arg_handling  sp    				 	 	 	 
!	 	 	1a&)))6I.....r   c                    | j                             d           d             }| j                             d          d             }|                     t                    5   |g            d d d            n# 1 swxY w Y   |                     t                    5   |g            d d d            d S # 1 swxY w Y   d S )Nr  c                     d S r   r   os    r   infinite_cachez3TestLRU.test_lru_type_error.<locals>.infinite_cache  ry  r   r;   c                     d S r   r   r8  s    r   limited_cachez2TestLRU.test_lru_type_error.<locals>.limited_cache  ry  r   )r  r  rY   rZ   )r1   r:  r<  s      r   test_lru_type_errorzTestLRU.test_lru_type_error  se   
 
		t		,	,	 	 
-	,	 
		r		*	*	 	 
+	*	 y)) 	 	N2	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 y)) 	 	M"	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s$   #A;;A?A? B99B= B=c           	         | j                             d           fd            |                     fdt          d          D             g d           |                                                     | j                             ddd d                                                      |                                                     | j                             ddd d                     d S )	Nr  c                 N    | dk     r| S  | dz
             | dz
            z   S r  r   r  s    r   r  z/TestLRU.test_lru_with_maxsize_none.<locals>.fib  r  r   c                 &    g | ]} |          S r   r   r  s     r   r   z6TestLRU.test_lru_with_maxsize_none.<locals>.<listcomp>  r  r   r   r  r  r  r   r  r  rO   r   r  r  r  r  s    @r   test_lru_with_maxsize_nonez"TestLRU.test_lru_with_maxsize_none  s   			t		,	,	' 	' 	' 	' 
-	,	' 	4444%))444III	K 	K 	K))K""2tb"QQ	S 	S 	S))K""!TA"NN	P 	P 	P 	P 	Pr   c           	      t   | j                             d          d             dD ]K}|                     fdt          d          D             t	          t          d                               L|                                                     | j                             dddd	                     d S )
Nir  c                     | S r   r   r  s    r   eqz2TestLRU.test_lru_with_maxsize_negative.<locals>.eq      Hr   ro   c                 &    g | ]} |          S r   r   )r   r  rE  s     r   r   z:TestLRU.test_lru_with_maxsize_negative.<locals>.<listcomp>  s!    888bbee888r      r   i,  r  )r  r  rO   r   r/   r  r  )r1   r  rE  s     @r   test_lru_with_maxsize_negativez&TestLRU.test_lru_with_maxsize_negative  s    			s		+	+	 	 
,	+	 	L 	LA8888U3ZZ888$uSzz:J:JKKKKK""#q1"MM	O 	O 	O 	O 	Or   c                    dD ]}| j                             |          d             }|                      |d          d           |                     t                    5 } |d           d d d            n# 1 swxY w Y   |                     |j        j                   |                     t                    5   |d           d d d            n# 1 swxY w Y   d S )NNr  c                     d|          S )Nr^  r   r  s    r   r    z.TestLRU.test_lru_with_exceptions.<locals>.func  s    Qxr   r   r>   r  )r  r  rO   rY   r   assertIsNone	exception__context__)r1   r  r    cms       r   test_lru_with_exceptionsz TestLRU.test_lru_with_exceptions  sh    # 
	 
	G[""7++    ,+ TT!WWc***"":.. "R              bl6777"":..  R              
	 
	s$   !A99A=	 A=	=CC	C	c                    dD ]}| j                             |d          d             }|                      |d          d           |                     t           |d                    t          d                     |                      |d          d           |                     t           |d                    t          d                     |                      |d	          d           |                     t           |d	                    t          d                     |                      |d	          d           |                     t           |d	                    t          d                     |                     |                                j        d
           |                     |                                j        d
           d S )NrK  Tr  typedc                     | | z  S r   r   rI   s    r   r  z+TestLRU.test_lru_with_types.<locals>.square  s    1ur   r@   r*  g      @g      "@rI   rA   )r  r  rO   r   r  r  r  )r1   r  r  s      r   test_lru_with_typeszTestLRU.test_lru_with_types  s   " 	< 	<G[""7$"??  @?VVAYY***T&&))__d1gg666VVC[[#...T&&++..S		:::VVa[[[!,,,T&&1+++..Q888VVc]]]C000T&&3---00$s))<<<V..005q999V..007;;;;	< 	<r   c                 F    | j                             d          t                    }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d	           |                      |d
          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d            G d dt                    }|                      | |d                    d           |                      | |d                    d           |                      | |d                    d           |                      | |d                    d           |                      | |d                    d           |                      | |d                    d           d S )NT)rU  r9   r  True      ?z1.0r   r!  FFalse        z0.0r   z(1,))T)rZ  rn   z(0,))F)r\  c                       e Zd ZdS )8TestLRU.test_lru_cache_typed_is_not_recursive.<locals>.TNr'   r   r   r   Tr^  .  r  r   r_  )r  r  r   rO   r   )r1   cachedr_  s      r   %test_lru_cache_typed_is_not_recursivez-TestLRU.test_lru_cache_typed_is_not_recursive  s   2&&T&22488C(((v...e,,,C(((000e,,,v...&111000v...))6222000	 	 	 	 	 	 	 	 	$&111'

++V444&		**F333$&111(,,f555&		**F33333r   c           	         | j                                         fd            |                     fdt          d          D             g d           |                                                     | j                             dddd                                                      |                                                     | j                             dddd                     d S )	Nc                 R    | dk     r| S  | dz
             | dz
            z   S Nr:   r9   r  r   r  s    r   r  z/TestLRU.test_lru_with_keyword_args.<locals>.fib9  8    1uu31:::ac


**r   c                 (    g | ]} |           S r  r   r   numberr  s     r   r   z6TestLRU.test_lru_with_keyword_args.<locals>.<listcomp>?  s#    333vSS6]]]333r   r   r  r  r  r  r   rA  r  s    @r   test_lru_with_keyword_argsz"TestLRU.test_lru_with_keyword_args8  s   				 	 	+ 	+ 	+ 	+ 
!	 	+ 	3333r333III	
 	
 	
 	))K""2sR"PP	R 	R 	R))K""!S1"MM	O 	O 	O 	O 	Or   c           	         | j                             d           fd            |                     fdt          d          D             g d           |                                                     | j                             ddd d                                                      |                                                     | j                             ddd d                     d S )	Nr  c                 R    | dk     r| S  | dz
             | dz
            z   S rd  r   r  s    r   r  z<TestLRU.test_lru_with_keyword_args_maxsize_none.<locals>.fibI  re  r   c                 (    g | ]} |           S rg  r   rh  s     r   r   zCTestLRU.test_lru_with_keyword_args_maxsize_none.<locals>.<listcomp>N  s#    @@@F##---@@@r   r   r  r  r  r   rA  r  s    @r   'test_lru_with_keyword_args_maxsize_nonez/TestLRU.test_lru_with_keyword_args_maxsize_noneH  s   			t		,	,	+ 	+ 	+ 	+ 
-	,	+ 	@@@@eBii@@@III	K 	K 	K))K""2tb"QQ	S 	S 	S))K""!TA"NN	P 	P 	P 	P 	Pr   c           	      b   | j                             d          d             }|                      |dd          ddg           |                      |dd	          ddg           |                     |                                | j                             d
ddd                     d S )Nr;   r  c                  D    t          |                                           S r   )r/   items)r   s    r   r   z$TestLRU.test_kwargs_order.<locals>.fX  s    '''r   r9   r:   r=   )r>   r9   )r?   r:   )r?   r>   r   r  )r  r  rO   r  r  r   s     r   test_kwargs_orderzTestLRU.test_kwargs_orderV  s    			r		*	*	( 	( 
+	*	(Q!x&:;;;Q!x&:;;;K""!R!"LL	N 	N 	N 	N 	Nr   c                     dd} | j                                         |          }| j         j        D ]4}|                     t	          ||          t	          ||                     5d S )Nzomgzomg_annotationc                     dS )zf doc stringr  r   )rt  s    r   r   z,TestLRU.test_lru_cache_decoration.<locals>.fa  s    2r   )rt  ru  )r  r  r  rO   r   )r1   r   gr   s       r   test_lru_cache_decorationz!TestLRU.test_lru_cache_decoration`  s    	 	 	 	 $DK!!##A&&K3 	A 	ADWQ--wq$/?/?@@@@	A 	Ar   c                    	
 d\  }d   j                             |z                      		                                \  }}}}                     |d           t	          j                    	 fd
	fd}t          j                    }t          j	        d           	 
fdt          |          D             }t          j        |          5                                   d d d            n# 1 swxY w Y   	                                \  }}}} j         t          u r3                     ||                                ||z  |z
             n2                     ||                                ||z  |z
                                  ||           t	          j        |	          g}|
fd
t          |          D             z  }                                 t          j        |          5                                   d d d            n# 1 swxY w Y   t          j	        |           d S # t          j	        |           w xY w)N)r`      c                     d| z  |z   S r  r   r   s     r   r   z-TestLRU.test_lru_cache_threaded.<locals>.origk  r  r   r  r   c                                          d           t                    D ],}                     | d           | d                     -d S )Nr;   r   )waitr   rO   )r,  r  r   mr   r1   starts     r   fullz-TestLRU.test_lru_cache_threaded.<locals>.fullr  s^    JJrNNN1XX 6 6  1a$$q!**55556 6r   c                                           d           t          dz            D ]}                                  d S )Nr;   r:   )r}  r   r  )r  r   r~  r  s    r   clearz.TestLRU.test_lru_cache_threaded.<locals>.clearw  sD    JJrNNN1Q3ZZ       r   ư>c                 >    g | ]}t          j        |g           S )targetr   	threadingThreadr   r,  r  s     r   r   z3TestLRU.test_lru_cache_threaded.<locals>.<listcomp>  s;     * * * !'t1#>>> * * *r   r  c                 >    g | ]}t          j        |g           S r  r  r  s     r   r   z3TestLRU.test_lru_cache_threaded.<locals>.<listcomp>  s;     + + + "(A3??? + + +r   )r  r  r  rO   r  Eventr   getswitchintervalr   setswitchintervalr   r   start_threadssetr   r  r  r  )r1   r  r  r  r  r  r  orig_sithreadsr   r  r~  r   r  s   `        @@@@@r   test_lru_cache_threadedzTestLRU.test_lru_cache_threadedh  s:   1	 	 	.DK!!!A#!..t44*+,,..'fgx1%%%!!	6 	6 	6 	6 	6 	6 	6 	6 	6
	  	  	  	  	  	  	 
 '))!$'''	+* * * * %a* * *G!/88  		               /0llnn+D&'8{l**$$VQ///$$T1Q3<8888  +++  qsV|444Xq))) !'u5556G + + + +!&q+ + + +GKKMMM!/88  		               !'*****C!'****sU   0/I D 4I  DI DDI 	H*I *H..I 1H.2I I!c           
         	 d\  }t          j        |dz             t          j        |dz             t          j        |dz              j                            |z            fd                                                                 dd|z  df            fd		fdt          |          D             }t          j        |          5  t                    D ]}	                    d           
                                 	                    d           
                                 	                    d           
                                                                                      d|dz   |z  |z  |dz   f           	 d d d            d S # 1 swxY w Y   d S )	N)r`   rb   r9   r  c                 8                         d           d| z  S Nr;   r@   )r}  )rJ   pauses    r   r   z+TestLRU.test_lru_cache_threaded2.<locals>.f  s    JJrNNNq5Lr   r   c                      t                    D ]N}                     d                                |           d| z                                 d           Od S r  )r   r}  rO   )r  r   r~  r1   r  stops    r   testz.TestLRU.test_lru_cache_threaded2.<locals>.test  sd    1XX  

2  1q1u---		" r   c                 :    g | ]}t          j                   S )r  r  )r   r,  r  s     r   r   z4TestLRU.test_lru_cache_threaded2.<locals>.<listcomp>  s'    CCCQ9#4000CCCr   r;   )r  Barrierr  r  rO   r  r   r   r  r}  reset)
r1   r  r  r  r   r~  r  r  r  r  s
   `   @@@@@@r   test_lru_cache_threaded2z TestLRU.test_lru_cache_threaded2  s:    1!!A#&&!!A#&& 1%%			qs		+	+	 	 	 	 
,	+	 	!Q!Q888	 	 	 	 	 	 	 	 	
 DCCC%((CCC+G44 	I 	I1XX I I

2



2		"  !ac1Wac1Q31GHHHHI	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Is   "CF66F:=F:c                       j                             d          d              fdfdt          g d          D             }t          j        |          5  	 d d d            d S # 1 swxY w Y   d S )Nr:   r  c                 4    t          j        d           d| z  S )Ng{Gz?r@   )timesleeprI   s    r   r   z+TestLRU.test_lru_cache_threaded3.<locals>.f  s    JsOOOq5Lr   c                                          |           5                       |          d|z  |            d d d            d S # 1 swxY w Y   d S )N)threadr@   )rH  rO   )r  rJ   r   r1   s     r   r  z.TestLRU.test_lru_cache_threaded3.<locals>.test  s    Q'' 1 1  1q1ua0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s   $A		AAc                 F    g | ]\  }}t          j        ||f           S r  r  )r   r  vr  s      r   r   z4TestLRU.test_lru_cache_threaded3.<locals>.<listcomp>  sA     ; ; ;q! #4q!f=== ; ; ;r   )r9   r:   r:   r@   r:   )r  r  	enumerater   r  )r1   r  r   r  s   ` @@r   test_lru_cache_threaded3z TestLRU.test_lru_cache_threaded3  s    			q		)	)	 	 
*	)		1 	1 	1 	1 	1 	1; ; ; ;(99; ; ;+G44 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A..A25A2c                 $   | j                             d          d              G fdd            d                       d                     |                       d                     d                     d S )Nr;   r  c                     | S )zEUsed to demonstrate a reentrant lru_cache call within a single threadr   rI   s    r   	test_funcz.TestLRU.test_need_for_rlock.<locals>.test_func  s	     Hr   c                   ,    e Zd ZdZd Zd Z fdZdS )-TestLRU.test_need_for_rlock.<locals>.DoubleEqz=Demonstrate a reentrant lru_cache call within a single threadc                     || _         d S r   rI   r1   rJ   s     r   r  z6TestLRU.test_need_for_rlock.<locals>.DoubleEq.__init__  r  r   c                     | j         S r   rI   r\   s    r   r(  z6TestLRU.test_need_for_rlock.<locals>.DoubleEq.__hash__  s	    vr   c                 b    | j         dk    r  d                     | j         |j         k    S r  rI   )r1   r2   DoubleEqr  s     r   rB  z4TestLRU.test_need_for_rlock.<locals>.DoubleEq.__eq__  s5    6Q;;Ihhqkk***v((r   N)r(   r)   r*   r  r  r(  rB  )r  r  s   r   r  r    sW        KK    ) ) ) ) ) ) ) )r   r  r9   r:   r4  )r1   r  r  s    @@r   test_need_for_rlockzTestLRU.test_need_for_rlock  s     
		r		*	*	 	 
+	*			) 		) 		) 		) 		) 		) 		) 		) 		) 		) 		) 		((1++	((1++88A;;//!!	& 	& 	& 	& 	&r   c                      G  fddt                     } |d          } |d          } |d          }                     |j                                        d           dD ]1}                     |                    |          |dz  dz              2                     |j        |j        |j        fd                                |j                                        d	           d
D ]1}                     |                    |          |dz  dz              2                     |j        |j        |j        fd                                |j                                        d           dD ]1}                     |                    |          |dz  dz              2                     |j        |j        |j        fd                                |j                                        d                                |j                                        |j                                                                        |j                                        |j                                                                        |j                                        |j                                                   d S )Nc                   Z    e Zd ZdZ j                            d          d             ZdS )"TestLRU.test_lru_method.<locals>.Xr   r:   c                 2    | xj         dz  c_         |dz  | z   S r  r  r  s     r   r   z$TestLRU.test_lru_method.<locals>.X.f  s    

a

tDy r   N)r(   r)   r*   r  r  r  r   r\   s   r   Xr    sD        E[""1%%! ! &%! ! !r   r  r`   rb   )r   r   r:   r   )
r9   r:   r:   r@   r9   r9   r9   r:   r@   r@   r;   )r'  r   r   )rA   r'  r:   r:   )
r9   r:   r9   r9   r9   r9   r@   r:   r:   r:   )r'  rA   r   )r;   r;   r:   r:   )
r:   r9   r9   r9   r9   r:   r9   r@   r:   r9   )r'  rA   r`   )r  r  r:   r:   )r   rO   r   r  r  )r1   r  r>   r?   rE   rJ   s   `     r   test_lru_methodzTestLRU.test_lru_method  s   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! AaDDAaDDAaDD))<888- 	/ 	/AQSSVVQrTAX....!'17AG4i@@@))<888- 	/ 	/AQSSVVQrTAX....!'17AG4i@@@))>:::- 	/ 	/AQSSVVQrTAX....!'17AG4i@@@))>:::))13>>+;+;<<<))13>>+;+;<<<))13>>+;+;<<<<<r   c           	      d   | j         }|j        d         |j        |j        fD ]}t	          t
          j        dz             D ]n}|                     ||          5  t          j        t          j	        ||                    }| 
                    ||           d d d            n# 1 swxY w Y   od S )Nr   r9   )r   r    )r  cached_funccached_methcached_staticmethr   r   r   rH  r   r   r   )r1   r5  r   r   r   s        r   r   zTestLRU.test_pickle  s    n#S_c6KK 	- 	-Av6:;; - -\\A\66 - -#\&,q%*@*@AAFMM&!,,,- - - - - - - - - - - - - - --	- 	-s   >B##B'*B'c                    | j         }d }| j                            |d          }|j        d         |j        |j         | j                            d          |          f}|D ]Z}|                     |          5  t          j        |          }| 	                    ||           d d d            n# 1 swxY w Y   [d S )Nc                     d| z  |z   S r  r   r   s     r   r   zTestLRU.test_copy.<locals>.orig  r  r   r:   r   r    )
r  r  rL   r  r  r  r  rH  r   r   r1   r5  r   r#   funcsr   r   s          r   r   zTestLRU.test_copy  s
   n	 	 	{""4++#S_c6K)&&q))$//1 	) 	)A1%% ) )1fa((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	) 	)   <+B33B7	:B7	c                    | j         }d }| j                            |d          }|j        d         |j        |j         | j                            d          |          f}|D ]Z}|                     |          5  t          j	        |          }| 
                    ||           d d d            n# 1 swxY w Y   [d S )Nc                     d| z  |z   S r  r   r   s     r   r   z#TestLRU.test_deepcopy.<locals>.orig  r  r   r:   r   r  )r  r  rL   r  r  r  r  rH  r   r   r   r  s          r   r   zTestLRU.test_deepcopy  s   n	 	 	{""4++#S_c6K)&&q))$//1 	) 	)A1%% ) )q))fa((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	) 	)r  c                 D   | j                             d          d             }|                     |                                ddd           | j                             dd          d             }|                     |                                ddd           d S )	Nr:   r  c                      dS Nr9   r   r   r   r   r   z,TestLRU.test_lru_cache_parameters.<locals>.f      1r   FrT  r  Tc                      dS r  r   r   r   r   r   z,TestLRU.test_lru_cache_parameters.<locals>.f   r  r   )r  r  rO   cache_parametersr   s     r   test_lru_cache_parametersz!TestLRU.test_lru_cache_parameters  s    			q		)	)	 	 
*	)	++--1u/M/MNNN			t4		8	8	 	 
9	8	++--4$/O/OPPPPPr   c                      j         j        d             } G  fdd          }t          j        |          t          j        |j                  t          j        |j                  g}|D ]}                      |                        ~~t          j                     |D ]} 	                     |                        d S )Nc                     | S r   r   rI   s    r   test_functionz9TestLRU.test_lru_cache_weakrefable.<locals>.test_function&  rF  r   c                   x    e Zd Z j        j        d             Ze j        j         fd                        ZdS )-TestLRU.test_lru_cache_weakrefable.<locals>.Ac                 
    | |fS r   r   r  s     r   test_methodz9TestLRU.test_lru_cache_weakrefable.<locals>.A.test_method+  s    ay r   c                     | fS r   r   )rJ   r1   s    r   test_staticmethodz?TestLRU.test_lru_cache_weakrefable.<locals>.A.test_staticmethod/  s     ay r   N)r(   r)   r*   r  r  r  r2  r  r\   s   r   r6  r  *  si        ["! ! #"! ["! ! ! ! #" \! ! !r   r6  )
r  r  weakrefrefr  r  assertIsNotNonegccollectrN  )r1   r  r6  refsr  s   `    r   test_lru_cache_weakrefablez"TestLRU.test_lru_cache_weakrefable%  s    			 	 
			! 	! 	! 	! 	! 	! 	! 	! 	! 	! M**AM**A/002  	( 	(C  ''''

 	% 	%Cccee$$$$	% 	%r   N) r(   r)   r*   r  r  r  r!  r+  r0  r5  r=  rB  rI  rR  rW  ra  rj  rn  rr  rx  r   requires_working_threadingr  r  r  r  r  r   r   r   r  r  r   r   r   r  r    s       W& W& W&r
: 
: 
:6 6 661 1 1!7 !7 !7F
# 
# 
#/ / /  &P P PO O O   < < < 4 4 46O O O P P PN N NA A A 1022.+ .+ 32.+` 1022I I 32I6 1022  32& & &0= = =>- - -
) 
) 
)
) 
) 
)	Q 	Q 	Q% % % % %r   r  c                     d| z  |z   S r  r   r   s     r   py_cached_funcr  C      q519r   c                     d| z  |z   S r  r   r   s     r   c_cached_funcr  G  r  r   c                       e Zd ZeZefZe                                d             Ze	e                                d                         Z
dS )	TestLRUPyc                     d|z  |z   S r  r   r\  s      r   r  zTestLRUPy.cached_methP      1uqyr   c                     d| z  |z   S r  r   r   s     r   r  zTestLRUPy.cached_staticmethT       1uqyr   N)r(   r)   r*   r   r  r  r  r  r  r2  r  r   r   r   r  r  L  sx        F /K      \  r   r  c                       e Zd ZeZefZe                                d             Ze	e                                d                         Z
dS )TestLRUCc                     d|z  |z   S r  r   r\  s      r   r  zTestLRUC.cached_meth^  r  r   c                     d| z  |z   S r  r   r   s     r   r  zTestLRUC.cached_staticmethb  r  r   N)r(   r)   r*   r   r  r  r  r  r  r2  r  r   r   r   r  r  Z  sx        F.K      \  r   r  c                   
   e Zd Zd Zd Zd Zd Z ej        e	d          e
j        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 S )!TestSingleDispatchc                 *   t           j        d             }d }|                    t          |           |                      |d          d           |                      |d          d           |                      |g d          d           d S )Nc                     dS Nr   r   rG  s    r   rw  z3TestSingleDispatch.test_simple_overloads.<locals>.gj      6r   c                     dS )Nintegerr   rM  s    r   g_intz7TestSingleDispatch.test_simple_overloads.<locals>.g_intm  s    9r   r   r   r9   r  r9   r:   r@   )r
   singledispatchregisterr   rO   r1   rw  r  s      r   test_simple_overloadsz(TestSingleDispatch.test_simple_overloadsi  s    		!	 	 
"	!		 	 		

356***1y)))777V,,,,,r   c                 <   t           j        d             } G d d          } G d d|          } G d d|          } G d d	||          }d
 }d }|                    ||           |                    ||           |                      | |                      d           |                      | |                      d           |                      | |                      d           |                      | |                      d           d S )Nc                     dS r  r   rG  s    r   rw  z&TestSingleDispatch.test_mro.<locals>.gu  r  r   c                       e Zd ZdS )&TestSingleDispatch.test_mro.<locals>.ANr'   r   r   r   r6  r  x  r  r   r6  c                       e Zd ZdS )&TestSingleDispatch.test_mro.<locals>.CNr'   r   r   r   Cr  z  r  r   r  c                       e Zd ZdS )&TestSingleDispatch.test_mro.<locals>.BNr'   r   r   r   rQ  r  |  r  r   rQ  c                       e Zd ZdS )&TestSingleDispatch.test_mro.<locals>.DNr'   r   r   r   Dr  ~  r  r   r  c                     dS )Nr6  r   ra   s    r   g_Az(TestSingleDispatch.test_mro.<locals>.g_A      3r   c                     dS )NrQ  r   rc   s    r   g_Bz(TestSingleDispatch.test_mro.<locals>.g_B  r
  r   )r
   r  r  rO   )r1   rw  r6  r  rQ  r  r	  r  s           r   test_mrozTestSingleDispatch.test_mrot  s   		!	 	 
"	!		 	 	 	 	 	 	 		 	 	 	 	 	 	 		 	 	 	 	 	 	 		 	 	 	 	1 	 	 		 	 		 	 		

1c	

1c1133%%%1133%%%1133%%%1133%%%%%r   c                    t           j        d             }|                    t                    d             }|                      |d          d           |                      |d          d           |                     |                    t                    |           |                     |                    t                    |                    t                               d S )Nc                     dS r  r   rG  s    r   rw  z5TestSingleDispatch.test_register_decorator.<locals>.g  r  r   c                     d| S )Nzint r   rM  s    r   r  z9TestSingleDispatch.test_register_decorator.<locals>.g_int  s      q?"r   r   r   r  zint 12)	r
   r  r  r   rO   r   dispatchr   r   r  s      r   test_register_decoratorz*TestSingleDispatch.test_register_decorator  s    		!	 	 
"	!		
C	# 	# 
	#2'''2)))ajjoou---ajj((!**S//:::::r   c                     t           j        d             }|                     |j        d           t          j        j        dk     r|                     |j        d           d S d S )Nc                     dS )Simple testTestr   rG  s    r   rw  z6TestSingleDispatch.test_wrapping_attributes.<locals>.g  s	     6r   rw  r:   r  )r
   r  rO   r(   r   r  r  r  )r1   rw  s     r   test_wrapping_attributesz+TestSingleDispatch.test_wrapping_attributes  so    		!	 	 
"	!	 	S)))9!!QY66666 "!r   zrequires _decimalc                 0   t           j        d             }|                    t          j                  d             }t                              d          }t                              d          }|                      ||          d           |                      ||          d           |                    t          j                  d             }|                      ||          d           |                      ||          d           d S )	Nc                     dS r  r   rG  s    r   rw  z,TestSingleDispatch.test_c_classes.<locals>.g  r  r   c                     | j         S r   r3  rG  s    r   r  z,TestSingleDispatch.test_c_classes.<locals>._  s	    8Or   Exponent < EminNumber got rounded)r  )r  c                     dS )NToo small to care.r   rG  s    r   r  z,TestSingleDispatch.test_c_classes.<locals>._  s    ''r   r  )r
   r  r  r   DecimalException	SubnormalRoundedrO   )r1   rw  r  subnrnds        r   test_c_classesz!TestSingleDispatch.test_c_classes  s    
	!	 	 
"	!		
G,	-	-	 	 
.	-	  !233oo2334"67773!8999	
G%	&	&	( 	( 
'	&	(4"67773!899999r   c                 6   t           j        }t          j        }|j        |j        |j        |j        g}t          |          D ]Y} |t          |          }| 
                    |t          |j        |j        |j        |j        |j        |j        t          g           Z|j        |j        |j        t           j        g}t          |          D ]c} |t           j        |          }| 
                    |t           j        |j        |j        |j        |j        |j        |j        t          g           d|j        |j        t$          g}t          |          D ]c} |t           j        |j        |j        t$          g          }| 
                    |t           j        t          |j        |j        t          g           d G d dt           j                  }|j                            |           |j        |j        g}t          |          D ]r} |||          }| 
                    |||j        |j        |j        t           j        t          |j        |j        |j        |j        |j        |j        t          g           s G d dt           j                  }|j        |j        |j        |j        g}t          |          D ]`} |||          }| 
                    |||j        t           j        t          |j        |j        |j        |j        |j        t          g
           ad S )Nc                       e Zd ZdS ).TestSingleDispatch.test_compose_mro.<locals>.DNr'   r   r   r   r  r'    r  r   r  c                       e Zd Zd ZdS ).TestSingleDispatch.test_compose_mro.<locals>.Cc                     d S r   r   r\   s    r   __call__z7TestSingleDispatch.test_compose_mro.<locals>.C.__call__      r   Nr(   r)   r*   r+  r   r   r   r  r)    #            r   r  )r*  r^  r
   _compose_mroSequenceMutableMappingMappingSetr   rP   rO   
CollectionSizedIterable	Containerr   OrderedDictChainMapr   defaultdictMutableSequencer  
ReversibleCallable)r1   rE   mror  haystackr~  r  r  s           r   test_compose_mroz#TestSingleDispatch.test_compose_mro  s0   O$Q-qy!%@$U++ 	7 	7HD(##AQq'7!"qw
!"f!6 7 7 7 7 ai)9;;RS$U++ 	7 	7HK((33AQ!5q7G!"qw
!"f!6 7 7 7 7 ags+$U++ 	7 	7HK+agq{C-HIIAQ!8$!"f!6 7 7 7 7	 	 	 	 	' 	 	 		""1%%%"A$45$U++ 	* 	*HAuAQA$5qz1<!,!8$@PRSR[!"qw
AK!'!) * * * *	 	 	 	 	' 	 	 	 !*ak19=$U++ 	7 	7HAx  AQAJ0Gqy!"qw
!"f!6 7 7 7 7	7 	7r   c                 p   t           j        }ddi}g d}t                      d h}t          |          }d}t          j        d             }|                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j	        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t           j
        d
            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    |j        d            |                      ||          d	           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t           d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t"          d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t$          d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t          d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                    t&          d            |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           |                      ||          d           d S )Nr>   r?   r  c                     dS r  r   rG  s    r   rw  z/TestSingleDispatch.test_register_abc.<locals>.g  r  r   r   c                     dS Nsizedr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>       r   rE  c                     dS Nmutablemappingr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>   s    1A r   rI  c                     dS )Nchainmapr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>  s    Z r   c                     dS )Nmutablesequencer   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>  s    2C r   rM  c                     dS )N
mutablesetr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>  s    \ r   rO  c                     dS Nmappingr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>  s    ) r   c                     dS Nsequencer   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>      : r   rU  c                     dS Nr  r   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>$      e r   r  c                     dS NrP   r   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>*      V r   rP   c                     dS Nr/   r   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>0  r\  r   r/   c                     dS )Nconcrete-setr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>6  s    N r   r`  c                     dS )N
frozen-setr   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda><  s    , r   rb  c                     dS )Nr   r   rG  s    r   rK   z6TestSingleDispatch.test_register_abc.<locals>.<lambda>B  s    g r   r   )r*  r^  r   	frozensetr
   r  rO   r  r5  r1  r9  r;  
MutableSetr2  r0  r3  rP   r/   r  r   )r1   rE   rd   lr   r   trw  s           r   test_register_abcz$TestSingleDispatch.test_register_abc  s	   O#JIIXXtaLL		!	 	 
"	!	1v&&&1v&&&1v&&&1v&&&1v&&&	

17//0001w'''1w'''1w'''1w'''1w'''	

1#%A%ABBB1/0001w'''1w'''1w'''1w'''	

;')?)?@@@1/0001w'''1w'''1w'''1w'''	

1$&C&CDDD1/000101111w'''1w'''1w'''	

1<!9!9:::1/000101111|,,,1w'''1w'''	

19334441/000101111|,,,1w'''1w'''	

1:556661/000101111|,,,1w'''1z***	

15++,,,1/000101111|,,,1u%%%1z***	

4++,,,1v&&&101111|,,,1u%%%1z***	

4++,,,1v&&&1v&&&1|,,,1u%%%1z***	

3223331v&&&1v&&&1~...1u%%%1z***	

9667771v&&&1v&&&1~...1|,,,1z***	

5--...1v&&&1v&&&1~...1|,,,1w'''''r   c           	      R   t           j        }t          j        } G d dt                    } G d d|          }|j        j         G d dt                                } G d dt                    } G d	 d
|||          }||j        |||j        ||j        |t          g	}t          |j        |j        |j        g          D ]#}	| 
                     |||	          |           $|j        |j        |j        |j        |j        g}
| 
                     |||
          |           d S )Nc                       e Zd ZdS ))TestSingleDispatch.test_c3_abc.<locals>.ANr'   r   r   r   r6  rk  L  r  r   r6  c                       e Zd Zd ZdS ))TestSingleDispatch.test_c3_abc.<locals>.Bc                     dS r  r   r\   s    r   r   z1TestSingleDispatch.test_c3_abc.<locals>.B.__len__O  r   r   Nr(   r)   r*   r   r   r   r   rQ  rm  N  #            r   rQ  c                       e Zd ZdS ))TestSingleDispatch.test_c3_abc.<locals>.CNr'   r   r   r   r  rr  Q  rh  r   r  c                       e Zd ZdS ))TestSingleDispatch.test_c3_abc.<locals>.DNr'   r   r   r   r  rt  T  r  r   r  c                       e Zd Zd ZdS ))TestSingleDispatch.test_c3_abc.<locals>.Xc                     d S r   r   r\   s    r   r+  z2TestSingleDispatch.test_c3_abc.<locals>.X.__call__W  r,  r   Nr-  r   r   r   r  rv  V  r.  r   r  )abcs)r*  r^  r
   _c3_mror   r7  r  r=  r5  r   rO   r2  r6  )r1   rE   r>  r6  rQ  r  r  r  rq   rx  	many_abcss              r   test_c3_abczTestSingleDispatch.test_c3_abcI  s   O	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 
		 	 	 	 	 	 	 
			 	 	 	 	 	 	 		 	 	 	 	1a 	 	 	 qz1aa!VL !'1:q{!CDD 	: 	:DSS...9999YQ[!*M	QY///:::::r   c                     G d dt                     } G d d|          } G d d|          }t          j        d             }|                    |          d	             } |            }|                      ||          d
           d S )Nc                       e Zd Zd ZdS )1TestSingleDispatch.test_false_meta.<locals>.MetaAc                     dS r  r   r\   s    r   r   z9TestSingleDispatch.test_false_meta.<locals>.MetaA.__len__c  r   r   Nro  r   r   r   MetaAr~  b  rp  r   r  c                       e Zd ZdS )-TestSingleDispatch.test_false_meta.<locals>.ANr'   r   r   r   r6  r  e  r  r   r6  r  c                       e Zd ZdS ).TestSingleDispatch.test_false_meta.<locals>.AANr'   r   r   r   AAr  g  r  r   r  c                     dS )Nzbase Ar   ra   s    r   funz/TestSingleDispatch.test_false_meta.<locals>.funi  s    8r   c                     dS )Nfun Ar   ra   s    r   r  z-TestSingleDispatch.test_false_meta.<locals>._l      7r   r  )r   r
   r  r  rO   )r1   r  r6  r  r  r  aas          r   test_false_metaz"TestSingleDispatch.test_false_meta`  s    	 	 	 	 	D 	 	 		 	 	 	 	% 	 	 	 		 	 	 	 	 	 	 			!	 	 
"	!		a	 	 
	RTTR'*****r   c                    t           j        }t          j        d             } G d d|j                  } |            }|                      ||          d           |                    |j        d            |                    |j        d            |                    |j        d            |                    |j	        d            |                      ||          d	           |j                            |           |                      ||          d	           |j                            |           |                      ||          d	           |j	                            |           |                      ||          d
            G d d          } |            }|                      ||          d           |j                            |           |                      ||          d           |j                            |           | 
                    t                    5 } ||           d d d            n# 1 swxY w Y   |                     t          |j                  d            G d d|j                  } |            }	|                      ||	          d	           |j                            |           |                      ||	          d	           |j	                            |           |                      ||	          d
           t          j        d             }
|
                    |j                  d             }|
                    |j                  d             }| 
                    t                    5 } |
t          j        d                      d d d            n# 1 swxY w Y   |                     t          |j                  d            G d dt           j                  }|j                            |           t          j        d             }|                    |j                  d             }|                    |j                  d             } |            }|                      ||          d            G d d          } G d d||j                  } |            }|                      |
|          d	           |j                            |           |                      |
|          d	            G d  d!          } |            }|                      |
|          d	           |j                            |           | 
                    t                    5 } |
|           d d d            n# 1 swxY w Y   |                     t          |j                  d            G d" d#|j        |          }t          j        d$             }|                    |          d%             }|                    |j                  d&             } |            }|                      ||          d'           |j                            |           |                      ||          d(           d S ))Nc                     dS r  r   args    r   rw  z0TestSingleDispatch.test_mro_conflicts.<locals>.gt  r  r   c                       e Zd Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.Oc                     dS r  r   r\   s    r   r   z8TestSingleDispatch.test_mro_conflicts.<locals>.O.__len__x  r   r   Nro  r   r   r   Or  w  rp  r   r  r   c                     dS )Niterabler   r  s    r   rK   z7TestSingleDispatch.test_mro_conflicts.<locals>.<lambda>|  rV  r   c                     dS N	containerr   r  s    r   rK   z7TestSingleDispatch.test_mro_conflicts.<locals>.<lambda>}  s    K r   c                     dS rD  r   r  s    r   rK   z7TestSingleDispatch.test_mro_conflicts.<locals>.<lambda>~  rF  r   c                     dS rX  r   r  s    r   rK   z7TestSingleDispatch.test_mro_conflicts.<locals>.<lambda>  rY  r   rE  r  c                       e Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.PNr'   r   r   r   Pr    r  r   r  r  )z]Ambiguous dispatch: <class 'collections.abc.Container'> or <class 'collections.abc.Iterable'>z]Ambiguous dispatch: <class 'collections.abc.Iterable'> or <class 'collections.abc.Container'>c                       e Zd Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.Qc                     dS r  r   r\   s    r   r   z8TestSingleDispatch.test_mro_conflicts.<locals>.Q.__len__  r   r   Nro  r   r   r   Qr    rp  r   r  c                     dS r  r   r  s    r   hz0TestSingleDispatch.test_mro_conflicts.<locals>.h  r  r   c                     dS rD  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._  r  r   c                     dS r  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._      ;r   c                      dS r  r   r   r   r   rK   z7TestSingleDispatch.test_mro_conflicts.<locals>.<lambda>  s    a r   )zZAmbiguous dispatch: <class 'collections.abc.Container'> or <class 'collections.abc.Sized'>zZAmbiguous dispatch: <class 'collections.abc.Sized'> or <class 'collections.abc.Container'>c                       e Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.RNr'   r   r   r   Rr    r  r   r  c                     dS r  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>.i  r  r   c                     dS rQ  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._      9r   c                     dS rT  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._      :r   rU  c                       e Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.SNr'   r   r   r   Sr    r  r   r  c                       e Zd Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.Tc                     dS r  r   r\   s    r   r   z8TestSingleDispatch.test_mro_conflicts.<locals>.T.__len__  r   r   Nro  r   r   r   r_  r    rp  r   r_  c                       e Zd Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.Uc                     dS r  r   r\   s    r   r   z8TestSingleDispatch.test_mro_conflicts.<locals>.U.__len__  r   r   Nro  r   r   r   Ur    rp  r   r  c                       e Zd Zd ZdS )0TestSingleDispatch.test_mro_conflicts.<locals>.Vc                     dS r  r   r\   s    r   r   z8TestSingleDispatch.test_mro_conflicts.<locals>.V.__len__  r   r   Nro  r   r   r   Vr    rp  r   r  c                     dS r  r   r  s    r   jz0TestSingleDispatch.test_mro_conflicts.<locals>.j  r  r   c                     dS )Nr   r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._  s    3r   c                     dS r  r   r  s    r   r  z0TestSingleDispatch.test_mro_conflicts.<locals>._  r  r   r   r  )r*  r^  r
   r  r5  rO   r  r6  r7  r3  rY   r  r   r   rO  r:  r;  r1  )r1   rE   rw  r  r9  r  rS   re_oner  qr  r  re_twor  r  r   r  r_  rg  r  ure_threer  r  r  s                            r   test_mro_conflictsz%TestSingleDispatch.test_mro_conflictsr  s=   O		!	 	 
"	!		 	 	 	 	 	 	 	 ACC1v&&&	

1:55666	

1; 7 7888	

17//000	

15++,,,1w'''	
A1w'''	Q1w'''	q1u%%%	 	 	 	 	 	 	 	ACC1v&&&	
A1z***	Q|,, 	AaDDD	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 !!9	
 	
 	
	 	 	 	 	 	 	 	 ACC1w'''	
A1w'''	q1u%%%		!	 	 
"	!		
AG			 	 
			
AK	 	 	 	 
!	 	 |,, 	2Ak%ii00111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 !!9	
 	
 	
	 	 	 	 	' 	 	 		""1%%%		!	 	 
"	!		
A$	%	%	 	 
&	%		
A%	&	&	 	 
'	&	ACC1z***	 	 	 	 	 	 	 		 	 	 	 	17 	 	 	 ACC1w'''	Q1w'''	 	 	 	 	 	 	 	 ACC1w'''	Q|,, 	AaDDD	 	 	 	 	 	 	 	 	 	 	 	 	 	 	"##9	
 	
 	
	 	 	 	 	 	 	 	 
	!	 	 
"	!		
A	 	 
		
AK	 	 	 	 
!	 	ACC1s###	Q1{+++++s6   ;III)OOO*WW	Wc                   	 ddl m} dd l} G fdd|                       	t          j        |d	fd          5  t           j        }t          j        d             }i }g }|                     t          	          d           |                      ||          d           |                     t          	          d	           |                     	j
        g            |                     	j        t          g           |                     	j        t                   |j        t                              |                      ||          d           |                     t          	          d
           |                     	j
        g            |                     	j        t          t           g           |                     	j        t                   |j        t                              |                     	j        t                    |j        t                              |                     	j        t                   	j        t                               |                      ||          d           |                      ||          d           |                     	j
        t           t          g           |                     	j        t          t           g           |                    t           d            |                     	j
        t           t          g           |                     t          	          d           |                      ||          d           |                     t          	          d	           |                     	j
        t           t          g           |                     	j        t          t           t          g           |                     	j        t                   t          j        t          |j                             |                      ||          d           |                     t          	          d
           |                     	j
        t           t          g           |                     	j        t          t           t          t           g           |                     	j        t                    t          j        t           |j                              G d d          }|j                            |           |                      ||          d           |                      ||          d           |                     	j
        t           t          t          t           g           |                     	j        t          t           t          t           g           |                    |j        d            |                     t          	          d           |                      ||          d           |                     t          	          d	           |                     	j
        t           t          t          t           g           |                     	j        t          t           t          t           t          g           |                      ||          d           |                     t          	          d
           |                     	j
        t           t          t          t           g           |                     	j        t          t           t          t           t          t           g           |                      ||          d           |                      ||          d           |                     	j
        t           t          t          t           t           t          g           |                     	j        t          t           t          t           t          t           g           |                    t                      |                    t                     |                     	j
        t           t          t          t           t           t          t           t          g           |                     	j        t          t           t          t           t          t           g           |j                            |           |                     t          	          d
           |                      ||          d           |                     t          	          d	           |                    |j        d            |                     t          	          d           |                      ||          d           |                     t          	          d	           |                      ||          d           |                     t          	          d
           |                    t          d            |                      ||          d           |                      ||          d           |                                 |                     t          	          d           d d d            d S # 1 swxY w Y   d S )Nr   )UserDictc                   4     e Zd Z fdZd Zd Zd Z xZS )?TestSingleDispatch.test_cache_invalidation.<locals>.TracingDictc                 Z     t          |           j        |i | g | _        g | _        d S r   )r  r  set_opsget_ops)r1   r   r   TracingDictr  s      r   r  zHTestSingleDispatch.test_cache_invalidation.<locals>.TracingDict.__init__  s7    1k4((14B6BBB!!r   c                 T    | j         |         }| j                            |           |S r   )r   r  r  )r1   r   results      r   r   zKTestSingleDispatch.test_cache_invalidation.<locals>.TracingDict.__getitem__  s(    3##C(((r   c                 N    | j                             |           || j        |<   d S r   )r  r  r   )r1   r   r   s      r   __setitem__zKTestSingleDispatch.test_cache_invalidation.<locals>.TracingDict.__setitem__  s'    ##C(((!&	#r   c                 8    | j                                          d S r   )r   r  r\   s    r   r  zETestSingleDispatch.test_cache_invalidation.<locals>.TracingDict.clear	  s    	!!!!!r   )r(   r)   r*   r  r   r  r  r  )r  r  s   @r   r  r    sk        " " " " " "  ' ' '" " " " " " "r   r  WeakKeyDictionaryc                       S r   r   )tds   r   rK   z<TestSingleDispatch.test_cache_invalidation.<locals>.<lambda>	  s    R r   c                     dS r  r   r  s    r   rw  z5TestSingleDispatch.test_cache_invalidation.<locals>.g	      vr   r   r9   r:   c                     dS r^  r   r  s    r   rK   z<TestSingleDispatch.test_cache_invalidation.<locals>.<lambda>	       r   r/   c                       e Zd ZdS )5TestSingleDispatch.test_cache_invalidation.<locals>.XNr'   r   r   r   r  r  -	  s        r   r  c                     dS rD  r   r  s    r   rK   z<TestSingleDispatch.test_cache_invalidation.<locals>.<lambda>5	  s    G r   rE  c                     dS rH  r   r  s    r   rK   z<TestSingleDispatch.test_cache_invalidation.<locals>.<lambda>L	  s    5E r   rI  c                     dS r[  r   r  s    r   rK   z<TestSingleDispatch.test_cache_invalidation.<locals>.<lambda>R	  r  r   rP   )r*  r  r  r   	swap_attrr^  r
   r  rO   r  r  r  rP   r   registryr   r/   r  
_find_implr1  r5  r  re  _clear_cache)
r1   r  r  rE   rw  rd   rf  r  r  r  s
           @@r   test_cache_invalidationz*TestSingleDispatch.test_cache_invalidation  sH	   ((((((	" 	" 	" 	" 	" 	" 	"( 	" 	" 	" []]w(;ZZZZHH P	) P	)A%  &%AASWWa(((QQqTT6***SWWa(((RZ,,,RZ$000RWT]AJv,>???QQqTT6***SWWa(((RZ,,,RZ$666RWT]AJv,>???RWT]AJv,>???RWT]BGDM:::QQqTT6***QQqTT6***RZ$666RZ$666JJt//000RZ$666SWWa(((QQqTT6***SWWa(((RZ$666RZ$d);<<<RWT]&1$
CCE E EQQqTT6***SWWa(((RZ$666RZ$dD)ABBBRWT]&1$
CCE E E       %%a(((QQqTT6***QQqTT6***RZ$dD)ABBBRZ$dD)ABBBJJqw 3 3444SWWa(((QQqTT7+++SWWa(((RZ$dD)ABBBRZ$dD$)GHHHQQqTT6***SWWa(((RZ$dD)ABBBRZ$dD$)MNNNQQqTT6***QQqTT7+++RZ$dD$)MNNNRZ$dD$)MNNNJJtJJtRZ$dD$*.*6 7 7 7RZ$dD$)MNNNL!!!$$$SWWa(((QQqTT6***SWWa(((JJq')E)EFFFSWWa(((QQqTT#3444SWWa(((QQqTT6***SWWa(((JJt//000QQqTT6***QQqTT6***NNSWWa(((aP	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	) P	)s    jkkkc                 l   t           j        d             }|j        dt          j        j        fd            }|j        dd            }|                      |d           d           |                      |ddi          d	           |                      |g d
          d           |                      |d
          d           |                      |d          d           |                    t                     G d d                      }|                      |d          d           d S )Nc                     dS r  r   r  s    r   r  z.TestSingleDispatch.test_annotations.<locals>.iY	  r  r   r  c                     dS rQ  r   r  s    r   r  z.TestSingleDispatch.test_annotations.<locals>._\	  r  r   collections.abc.Sequencec                     dS rT  r   r  s    r   r  z.TestSingleDispatch.test_annotations.<locals>.__	  r  r   r   r>   r9   rR  r  rU  r   c                       e Zd Zd Zd ZdS ).TestSingleDispatch.test_annotations.<locals>._c                     || _         d S r   r  r1   r  s     r   r  z7TestSingleDispatch.test_annotations.<locals>._.__init__l	      r   c                     | j         |k    S r   r  r0   s     r   rB  z5TestSingleDispatch.test_annotations.<locals>._.__eq__o	  s    x5((r   N)r(   r)   r*   r  rB  r   r   r   r  r  j	  s2          ) ) ) ) )r   r  )r  r  )r
   r  r  r*  r^  r2  rO   r   )r1   r  r  s      r   test_annotationsz#TestSingleDispatch.test_annotationsX	  sm   		!	 	 
"	!		
	;?* 	 	 	 
		
	 	 	 
	4&)))C8i000999z2229z2225:... 
C	) 	) 	) 	) 	) 	) 	) 
	) 	55)))))r   c                 b    G d d          } |            }|                     d           |                     |j        d            |            }|                     t	          |d                     |                     d           |                     |j        d            |            }|                     t	          |d                     |                     d           |                     |j        d	            |            }|                     t	          |d                     d S )
Nc                       e Zd Zej        d             Ze                    e          d             Ze                    e	          d             ZdS )2TestSingleDispatch.test_method_register.<locals>.Ac                     d| _         d S r  r  r  s     r   rg  z4TestSingleDispatch.test_method_register.<locals>.A.tu	  s    !r   c                     d| _         d S Nr   r  r  s     r   r  z4TestSingleDispatch.test_method_register.<locals>.A._x	       r   c                     d| _         d S Nr   r  r  s     r   r  z4TestSingleDispatch.test_method_register.<locals>.A._{	  r  r   N
r(   r)   r*   r
   singledispatchmethodrg  r  r   r  r   r   r   r   r6  r  t	  sw        +" " ,+"ZZ__! ! _!ZZ__! ! _! ! !r   r6  r   r   r  r   r   r\  r   )rg  rO   r  rC  rD  )r1   r6  r>   r  s       r   test_method_registerz'TestSingleDispatch.test_method_registers	  s-   		! 		! 		! 		! 		! 		! 		! 		! ACC	A&&&QSSU++,,,	B&&&QSSU++,,,	C'''QSSU++,,,,,r   c                 &    G d d          } |            }|                      |                    d                     |                      |                    d                     |                     |                    d          d           d S )Nc                       e Zd Zej        ed                         Ze                    e          ed                         Z	e                    e
          ed                         Z	dS )8TestSingleDispatch.test_staticmethod_register.<locals>.Ac                     | S r   r   r  s    r   rg  z:TestSingleDispatch.test_staticmethod_register.<locals>.A.t	  	     
r   c                 ,    t          | t                    S r   rt  r   r  s    r   r  z:TestSingleDispatch.test_staticmethod_register.<locals>.A._	       "#s+++r   c                 ,    t          | t                    S r   rt  r   r  s    r   r  z:TestSingleDispatch.test_staticmethod_register.<locals>.A._	  r  r   Nr(   r)   r*   r
   r  r2  rg  r  r   r  r   r   r   r   r6  r  	  s        +  \ ,+ZZ__, , \ _,ZZ__, , \ _, , ,r   r6  r   r   r\  rM   rg  rO   r1   r6  r>   s      r   test_staticmethod_registerz-TestSingleDispatch.test_staticmethod_register	      	, 	, 	, 	, 	, 	, 	, 	, ACCAB   S3'''''r   c                 4    G d d          }|                      |                    d          j        d           |                      |                    d          j        d           |                      |                    d          j        d           d S )	Nc                       e Zd Zd Zej        ed                         Ze                    e	          ed                         Z
e                    e          ed                         Z
dS )7TestSingleDispatch.test_classmethod_register.<locals>.Ac                     || _         d S r   r  r  s     r   r  z@TestSingleDispatch.test_classmethod_register.<locals>.A.__init__	  r  r   c                      | d          S r  r   r5  r  s     r   rg  z9TestSingleDispatch.test_classmethod_register.<locals>.A.t	       s6{{"r   c                      | d          S r  r   r  s     r   r  z9TestSingleDispatch.test_classmethod_register.<locals>.A._	       s5zz!r   c                      | d          S r  r   r  s     r   r  z9TestSingleDispatch.test_classmethod_register.<locals>.A._	  r  r   Nr(   r)   r*   r  r
   r  r4  rg  r  r   r  r   r   r   r   r6  r  	  s           +# # [ ,+#ZZ__" " [ _"ZZ__" " [ _" " "r   r6  r   r   r   r   r\  r   rO   rg  r  rH  s     r   test_classmethod_registerz,TestSingleDispatch.test_classmethod_register	      	" 	" 	" 	" 	" 	" 	" 	"" 	QU+++Re,,,Sv.....r   c                     G d d          }|j                             t                    t          d                         }|j                             t                    t          d                         }|                     |                     d          j        d           |                     |                     d          j        d           |                     |                     d	          j        d
           d S )Nc                   D    e Zd Zd Zej        ed                         ZdS )4TestSingleDispatch.test_callable_register.<locals>.Ac                     || _         d S r   r  r  s     r   r  z=TestSingleDispatch.test_callable_register.<locals>.A.__init__	  r  r   c                      | d          S r  r   r  s     r   rg  z6TestSingleDispatch.test_callable_register.<locals>.A.t	  r  r   N)r(   r)   r*   r  r
   r  r4  rg  r   r   r   r6  r  	  sL           +# # [ ,+# # #r   r6  c                      | d          S r  r   r  s     r   r  z4TestSingleDispatch.test_callable_register.<locals>._	       3u::r   c                      | d          S r  r   r  s     r   r  z4TestSingleDispatch.test_callable_register.<locals>._	  r"  r   r   r   r   r   r\  r   )rg  r  r   r4  r   rO   r  )r1   r6  r  s      r   test_callable_registerz)TestSingleDispatch.test_callable_register	  s    	# 	# 	# 	# 	# 	# 	# 	# 
c				 	 
 
			
c				 	 
 
		 	QU+++Re,,,Sv.....r   c                 :    G d dt           j                  }|                     |j        j                   |                     |j        d         j                   |                     t                    5   |             d d d            d S # 1 swxY w Y   d S )Nc                   H    e Zd Zej        ej        d                         ZdS )ATestSingleDispatch.test_abstractmethod_register.<locals>.Abstractc                     d S r   r   r\  s      r   r]  zETestSingleDispatch.test_abstractmethod_register.<locals>.Abstract.add	  s	     r   N)r(   r)   r*   r
   r  r^  r_  r]  r   r   r   ra  r'  	  s?        +    ,+  r   ra  r  r]  )r^  rc  rM   r]  rb  r"   rY   rZ   )r1   ra  s     r   test_abstractmethod_registerz/TestSingleDispatch.test_abstractmethod_register	  s    	 	 	 	 	 	 	 	 	 	9:::)%0EFFFy)) 	 	HJJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   8BBBc                 *    G d d          } |            }|                      |                    d          d           |                      |                    d          d           |                      |                    d          d           d S )	Nc                   z    e Zd Zej        d             Zej        defd            Zej        de	fd            ZdS )4TestSingleDispatch.test_type_ann_register.<locals>.Ac                     dS r  r   r  s     r   rg  z6TestSingleDispatch.test_type_ann_register.<locals>.A.t	  r  r   r  c                     dS r  r   r  s     r   r  z6TestSingleDispatch.test_type_ann_register.<locals>.A._	      ur   c                     dS r  r   r  s     r   r  z6TestSingleDispatch.test_type_ann_register.<locals>.A._	  r/  r   Nr  r   r   r   r6  r,  	  s        +  ,+ZS    ZZS    Z  r   r6  r   r   r   r   r\  r   )rO   rg  r  s      r   test_type_ann_registerz)TestSingleDispatch.test_type_ann_register	  s    		 		 		 		 		 		 		 		 ACCQ'''R%(((S6*****r   c                 &    G d d          } |            }|                      |                    d                     |                      |                    d                     |                     |                    d          d           d S )Nc                       e Zd Zej        ed                         Zej        edefd                        Z	ej        ede
fd                        Z	dS )ATestSingleDispatch.test_staticmethod_type_ann_register.<locals>.Ac                     | S r   r   r  s    r   rg  zCTestSingleDispatch.test_staticmethod_type_ann_register.<locals>.A.t	  r  r   r  c                 ,    t          | t                    S r   r  r  s    r   r  zCTestSingleDispatch.test_staticmethod_type_ann_register.<locals>.A._	  r  r   c                 ,    t          | t                    S r   r  r  s    r   r  zCTestSingleDispatch.test_staticmethod_type_ann_register.<locals>.A._	  r  r   Nr	  r   r   r   r6  r4  	  s        +  \ ,+Z,s , , , \ Z,Z,s , , , \ Z, , ,r   r6  r   r   r\  r
  r  s      r   #test_staticmethod_type_ann_registerz6TestSingleDispatch.test_staticmethod_type_ann_register	  r  r   c                 4    G d d          }|                      |                    d          j        d           |                      |                    d          j        d           |                      |                    d          j        d           d S )	Nc                       e Zd Zd Zej        ed                         Zej        ede	fd                        Z
ej        edefd                        Z
dS )@TestSingleDispatch.test_classmethod_type_ann_register.<locals>.Ac                     || _         d S r   r  r  s     r   r  zITestSingleDispatch.test_classmethod_type_ann_register.<locals>.A.__init__
  r  r   c                      | d          S r  r   r  s     r   rg  zBTestSingleDispatch.test_classmethod_type_ann_register.<locals>.A.t
  r  r   r  c                      | d          S r  r   r  s     r   r  zBTestSingleDispatch.test_classmethod_type_ann_register.<locals>.A._

  r  r   c                      | d          S r  r   r  s     r   r  zBTestSingleDispatch.test_classmethod_type_ann_register.<locals>.A._
  r  r   Nr  r   r   r   r6  r;  
  s           +# # [ ,+#Z"C " " " [ Z"Z"C " " " [ Z" " "r   r6  r   r   r   r   r\  r   r  rH  s     r   "test_classmethod_type_ann_registerz5TestSingleDispatch.test_classmethod_type_ann_register
  r  r   c                 0    G d d          }|j          |            j         |j         |            j        |j         |            j        fD ]q}|                     |          5  |                     |j        d           |                     |j        d         t                     d d d            n# 1 swxY w Y   r|                     |j         j        d           |                      |            j         j        d           |                     |j        j        d           |                      |            j        j        d           |                     |j        j        d           |                      |            j        j        d           d S )	Nc                       e Zd Zej        dedefd            Zej        ededefd                        Z	ej        e
dedefd                        ZdS )=TestSingleDispatch.test_method_wrapping_attributes.<locals>.Ar  returnc                      t          |          S My function docstringr   r  s     r   r    zBTestSingleDispatch.test_method_wrapping_attributes.<locals>.A.func
       3xxr   c                      t          |          S rF  rH  r  s     r   cls_funczFTestSingleDispatch.test_method_wrapping_attributes.<locals>.A.cls_func
       3xxr   c                      t          |           S rF  rH  r  s    r   static_funczITestSingleDispatch.test_method_wrapping_attributes.<locals>.A.static_func"
  rL  r   N)r(   r)   r*   r
   r  r   r   r    r4  rK  r2  rN  r   r   r   r6  rC  
  s        +          ,+  + 3  3       [ ,+  +          \ ,+     r   r6  methrG  r  r    rK  rN  )	r    rK  rN  rH  rO   r  r  r   r(   )r1   r6  rP  s      r   test_method_wrapping_attributesz2TestSingleDispatch.test_method_wrapping_attributes
  s   	  	  	  	  	  	  	  	 " FACCHJACCLMACCO
 
	C 
	CD 4(( C C  /FGGG  !5e!<cBBBC C C C C C C C C C C C C C C 	&111*F333,j999.
;;;/???1=AAAAAs   $AB22B6	9B6	c           	         d  G fdd          } G fdd          }|                     d          5 }|}d d d            n# 1 swxY w Y   |                     d          5 }|}d d d            n# 1 swxY w Y   |                     ||           |                     |d           |                     |                    d          |                    d                     |                     |                    d          d           dD ]}|                     |	          5  |                     t	          ||          j        t	          ||          j                   |                     t	           |            |          j        t	           |            |          j                   d d d            n# 1 swxY w Y   |j          |            j         |j         |            j        fD ]q}|                     |
          5  |                     |j        d           |                     |j        d         t                     d d d            n# 1 swxY w Y   r|                     |j         j        d           |                      |            j         j        d           |                     |j        j        d           |                      |            j        j        d           d S )Nc                 n    | j         t          t          j                  fd                        }|S )Nc                       | i |S r   r   )r   r   rn  s     r   rm  zgTestSingleDispatch.test_double_wrapped_methods.<locals>.classmethod_friendly_decorator.<locals>.wrapper>
  s     w////r   )__func__r4  r
   r  )r    rm  rn  s     @r   classmethod_friendly_decoratorzVTestSingleDispatch.test_double_wrapped_methods.<locals>.classmethod_friendly_decorator<
  sG    mG_W%%0 0 0 0 &% [0Nr   c                   z    e Zd Zeej        dedefd                        Z ededefd                        Z	dS )MTestSingleDispatch.test_double_wrapped_methods.<locals>.WithoutSingleDispatchr  rD  c              3   >   K   	 t          |          V  dS #  Y dS xY w)NDonerH  r  s     r   cls_context_managerzaTestSingleDispatch.test_double_wrapped_methods.<locals>.WithoutSingleDispatch.cls_context_managerE
  s.      "c((NNN!66666666    c                      t          |          S r   rH  r  s     r   decorated_classmethodzcTestSingleDispatch.test_double_wrapped_methods.<locals>.WithoutSingleDispatch.decorated_classmethodM
  rI  r   N)
r(   r)   r*   r4  
contextlibcontextmanagerr   r   r[  r^  rV  s   r   WithoutSingleDispatchrX  D
  s        &"c "c " " " '& [" ,          [ ,+     r   rb  c                       e Zd Zej        eej        dede	fd                                    Z
ej         edede	fd                                    ZdS )JTestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatchr  rD  c              3   >   K   	 t          |          V  dS #  Y dS xY w)rG  rZ  rH  r  s     r   r[  z^TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.cls_context_managerS
  s.      
"c((NNN!66666666r\  c                      t          |          S rF  rH  r  s     r   r^  z`TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.decorated_classmethod]
  s    
 3xxr   N)r(   r)   r*   r
   r  r4  r_  r`  r   r   r[  r^  ra  s   r   WithSingleDispatchrd  R
  s        +&"c "c " " " '& [ ,+" ++          [ ,+ ,+     r   rg  r`   5)r[  r^  )rP  rO  rG  r  r[  r^  )	r[  rO   r^  rH  r   r(   r  r  r   )	r1   rb  rg  r   without_single_dispatch_foosingle_dispatch_foomethod_namerP  rV  s	           @r   test_double_wrapped_methodsz.TestSingleDispatch.test_double_wrapped_methods;
  s   	 	 		  	  	  	  	  	  	  	  	  	 	  	  	  	  	  	  	  	  	  	 ( #66q99 	.S*-'	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.  33A66 	&#"%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	46IJJJ,c222!77::44Q77	
 	
 	

 	+AA!DDcJJJ L 
	 
	K[11 	 	  .<<E1;??H  
   ..00+>>G1133[AAJ  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 2  44  6	
 	C 	CD 4(( C C  /FGGG  !5e!<cBBBC C C C C C C C C C C C C C C 	2;!	
 	
 	
 	  4=!	
 	
 	
 	4=#	
 	
 	
 	  6?#	
 	
 	
 	
 	
sI   AAA'A66A:=A:,B	GG	G	AII!	$I!	c                    d}d}t           j        d             }|                     t                    5 }|                    d          d             }d d d            n# 1 swxY w Y   |                     t          |j                                      |dz                        |                     t          |j                  	                    |                     |                     t                    5 }|j        d             }d d d            n# 1 swxY w Y   |                     t          |j                                      |dz                        |                     t          |j                  	                    |                     |                     t                    5 }|j        d	t          j        t                   fd
            }d d d            n# 1 swxY w Y   |                     t          |j                                      d                     |                     t          |j                  	                    d                     |                     t                    5 }|j        d	t          j        t          t          j        t                   f         fd            }d d d            n# 1 swxY w Y   |                     t          |j                                      d                     |                     t          |j                  	                    d                     d S )Nz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.c                     dS r  r   r  s    r   r  z8TestSingleDispatch.test_invalid_registrations.<locals>.i
  r  r   r  c                     dS )NzI annotated with a non-typer   r  s    r   r  z8TestSingleDispatch.test_invalid_registrations.<locals>._
  s    44r   42c                     dS )NzI forgot to annotater   r  s    r   r  z8TestSingleDispatch.test_invalid_registrations.<locals>._
  s    --r   zB<function TestSingleDispatch.test_invalid_registrations.<locals>._r  c                     dS )Nz%I annotated with a generic collectionr   r  s    r   r  z8TestSingleDispatch.test_invalid_registrations.<locals>._
  s
     ?>r   zInvalid annotation for 'arg'.z$typing.Iterable[str] is not a class.c                     dS )NzInvalid Unionr   r  s    r   r  z8TestSingleDispatch.test_invalid_registrations.<locals>._
  s    &r   zFtyping.Union[int, typing.Iterable[str]] not all arguments are classes.)r
   r  rY   rZ   r  rM   r   rO  r  endswithtypingr6  Unionr   )r1   
msg_prefix
msg_suffixr  excr  s         r   test_invalid_registrationsz-TestSingleDispatch.test_invalid_registrations
  s   ?
" 	 
	!	 	 
"	!	y)) 	5SZZ^^5 5 ^5	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	CM**55j46GHHIIICM**33J??@@@y)) 	.SZ. . Z.	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	CM**55jP7Q 
 
 	 	 	 	CM**33J??@@@y)) 	?SZ?vs+ ? ? ? Z?	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	CM**55+
 
 	 	 	 	CM**332
 
 	 	 	 y)) 	'SZ'v|C)=$=> ' ' ' Z'	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	CM**55+
 
 	 	 	 	CM**33T
 
 	 	 	 	 	sH   AA#&A#;DDD4)G))G-0G-A KKKc                     t           j        d             }d}|                     t          |          5   |             d d d            d S # 1 swxY w Y   d S )Nc                      d S r   r   r3  s    r   r   z>TestSingleDispatch.test_invalid_positional_argument.<locals>.f
  ry  r   z)f requires at least 1 positional argument)r
   r  assertRaisesRegexrZ   )r1   r   msgs      r    test_invalid_positional_argumentz3TestSingleDispatch.test_invalid_positional_argument
  s    		!	 	 
"	!	9##Is33 	 	ACCC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                    t           j        d             }|j        dt          j        t
          t          f         fd            }|j        dt          t          z  fd            }| 	                     |g           d           | 	                     |d          d           | 	                     |d          d           | 	                     |d	          d
           | 	                     |d          d
           d S )Nc                     dS Ndefaultr   r  s    r   r   z(TestSingleDispatch.test_union.<locals>.f
  r  r   r  c                     dS Ntyping.Unionr   r  s    r   r  z(TestSingleDispatch.test_union.<locals>._
      !>r   c                     dS Ntypes.UnionTyper   r  s    r   r  z(TestSingleDispatch.test_union.<locals>._
      $$r   r  r   r  r   r9   r  rZ  )
r
   r  r  ru  rv  r   bytesr   floatrO   r1   r   r  s      r   
test_unionzTestSingleDispatch.test_union
  s    		!	 	 
"	!	 
	"6<U
+ 	" 	" 	" 
	" 
	%3; 	% 	% 	% 
	% 	2	***2///3000101113!233333r   c                    t           j        d             }|j        dt          j        t
          t          f         fd            }|j        dt          t
          z  fd            }|                      |g           d           |                      |d          d           |                      |d          d	           |                      |d
          d           d S )Nc                     dS r  r   r  s    r   r   z1TestSingleDispatch.test_union_conflict.<locals>.f
  r  r   r  c                     dS r  r   r  s    r   r  z1TestSingleDispatch.test_union_conflict.<locals>._
  r  r   c                     dS r  r   r  s    r   r  z1TestSingleDispatch.test_union_conflict.<locals>._
  r  r   r  r   r  r   r  r9   )	r
   r  r  ru  rv  r   r  r   rO   r  s      r   test_union_conflictz&TestSingleDispatch.test_union_conflict
  s   		!	 	 
"	!	 
	"6<U
+ 	" 	" 	" 
	" 
	%39 	% 	% 	% 
	% 	2	***2 122230001011111r   c                 X   t           j        d             }|j        dt          j        t
          d f         fd            }|                      |d          d           |                      |d          d           |                      |d           d           t           j        d             }|j        dt          d z  fd	            }|                      |d          d           |                      |d          d
           |                      |d           d
           d S )Nc                     dS r  r   r  s    r   typing_unionz8TestSingleDispatch.test_union_None.<locals>.typing_union
  r  r   r  c                     dS r  r   r  s    r   r  z-TestSingleDispatch.test_union_None.<locals>._  r  r   r9   r  r   r  c                     dS r  r   r  s    r   types_unionz7TestSingleDispatch.test_union_None.<locals>.types_union
  r  r   c                     dS r  r   r  s    r   r  z-TestSingleDispatch.test_union_None.<locals>._  r  r   r  )r
   r  r  ru  rv  r   rO   r   )r1   r  r  r  s       r   test_union_Nonez"TestSingleDispatch.test_union_None
  sg   		!	 	 
"	!	 
		"6<T	* 	" 	" 	" 
		" 	a)444b))>:::d++^<<<		!	 	 
"	!	 
		%3: 	% 	% 	% 
		% 	R)444Q):;;;T**,=>>>>>r   c                 0   t           j        d             }|                     t          d          5  |                    t
          t                   d            d d d            n# 1 swxY w Y   |                     t          d          5  |                    t          j        t                   d            d d d            n# 1 swxY w Y   |                     t          d          5  |                    t
          t                   t          z  d            d d d            n# 1 swxY w Y   |                     t          d          5  |                    t          j        t                   t          z  d            d d d            n# 1 swxY w Y   |                      |dg          d           |                      |d	g          d           |                      |d
          d           |                      |d          d           d S )Nc                     dS r  r   r  s    r   r   z8TestSingleDispatch.test_register_genericalias.<locals>.f  r  r   Invalid first argument to c                     dS Nztypes.GenericAliasr   r  s    r   rK   z?TestSingleDispatch.test_register_genericalias.<locals>.<lambda>  s    .B r   c                     dS Nztyping.GenericAliasr   r  s    r   rK   z?TestSingleDispatch.test_register_genericalias.<locals>.<lambda>  s    5J r   c                     dS )Nz$types.UnionTypes(types.GenericAlias)r   r  s    r   rK   z?TestSingleDispatch.test_register_genericalias.<locals>.<lambda>   s    4Z r   c                     dS Nz!typing.Union[typing.GenericAlias]r   r  s    r   rK   z?TestSingleDispatch.test_register_genericalias.<locals>.<lambda>"  s    ?b r   r9   r  rZ  r   r   )r
   r  r}  rZ   r  r/   r   ru  Listr   r  r  rO   r   s     r   test_register_genericaliasz-TestSingleDispatch.test_register_genericalias  s   		!	 	 
"	!	 ##I/KLL 	D 	DJJtCy"B"BCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D##I/KLL 	L 	LJJv{3')J)JKKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L##I/KLL 	\ 	\JJtCy3(Z(Z[[[	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\ 	\##I/KLL 	d 	dJJv{5)E13b3bccc	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	A3+++C59---2	***3+++++sG   (A%%A),A)-CCC*0D&&D*-D*5FFFc                 &   t           j        d             }|                     t          d          5  |                    t
          t                              d d d            n# 1 swxY w Y   |                     t          d          5  |                    t          j        t                              d d d            n# 1 swxY w Y   |                     t          d          5  |                    t
          t                   t          z             d d d            n# 1 swxY w Y   |                     t          d          5  |                    t          j        t                   t          z             d d d            d S # 1 swxY w Y   d S )Nc                     dS r  r   r  s    r   r   zBTestSingleDispatch.test_register_genericalias_decorator.<locals>.f*  r  r   r  )
r
   r  r}  rZ   r  r/   r   ru  r  r   r   s     r   $test_register_genericalias_decoratorz7TestSingleDispatch.test_register_genericalias_decorator)  sG   		!	 	 
"	!	 ##I/KLL 	" 	"JJtCy!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"##I/KLL 	) 	)JJv{3'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)##I/KLL 	( 	(JJtCy3'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(##I/KLL 	/ 	/JJv{3'#-...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/sG   &A##A'*A'	+C  CC&.D  D$'D$3FF
F
c                    t           j        d             }|                     t          d          5  |j        dt
          t                   fd            }d d d            n# 1 swxY w Y   |                     t          d          5  |j        dt          j        t                   fd            }d d d            n# 1 swxY w Y   |                     t          d          5  |j        dt
          t                   t          z  fd            }d d d            n# 1 swxY w Y   |                     t          d          5  |j        dt          j        t                   t          z  fd            }d d d            n# 1 swxY w Y   |                      |dg          d	           |                      |d
g          d	           |                      |d          d	           |                      |d          d	           d S )Nc                     dS r  r   r  s    r   r   zCTestSingleDispatch.test_register_genericalias_annotation.<locals>.f8  r  r   zInvalid annotation for 'arg'r  c                     dS r  r   r  s    r   r  zCTestSingleDispatch.test_register_genericalias_annotation.<locals>._=  s    ++r   c                     dS r  r   r  s    r   r  zCTestSingleDispatch.test_register_genericalias_annotation.<locals>._A  s    ,,r   c                     dS )Nz#types.UnionType(types.GenericAlias)r   r  s    r   r  zCTestSingleDispatch.test_register_genericalias_annotation.<locals>._E  s    <<r   c                     dS r  r   r  s    r   r  zCTestSingleDispatch.test_register_genericalias_annotation.<locals>._I  s    ::r   r9   r  rZ  r   r   )r
   r  r}  rZ   r  r/   r   ru  r  r  r   r  rO   r  s      r   %test_register_genericalias_annotationz8TestSingleDispatch.test_register_genericalias_annotation7  s   		!	 	 
"	!	 ##I/MNN 	, 	,Z,tCy , , , Z,	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, ##I/MNN 	- 	-Z-v{5) - - - Z-	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- ##I/MNN 	= 	=Z=tCy3 = = = Z=	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= ##I/MNN 	; 	;Z;v{5)E1 ; ; ; Z;	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;
 	A3+++C59---2	***3+++++sG   $A!!A%(A%)B<<C C ",DD!D 1E==FFN)&r(   r)   r*   r  r  r  r  r  
skipUnlessr   r   r3  r$  r@  rh  r{  r  r  r  r  r  r  r  r$  r)  r1  r8  r@  rQ  rl  rz  r  r  r  r  r  r  r  r   r   r   r  r  h  s       	- 	- 	-& & &.
; 
; 
;7 7 7 X"566: :  76:"47 47 47l\( \( \(|; ; ;.+ + +$}, }, },@d) d) d)L* * *6- - -4( ( ((/ / /,/ / /.  + + +"( ( ((/ / /,"B "B "BHa
 a
 a
F0 0 0d  4 4 4&2 2 2$? ? ?2, , ,&/ / /, , , , ,r   r  c                   8    e Zd ZdZd Zej        d             ZdS )CachedCostItemr9   c                 B    t                                           | _        d S r   )r   RLocklockr\   s    r   r  zCachedCostItem.__init__V  s     &&((			r   c                 n    | j         5  | xj        dz  c_        ddd           n# 1 swxY w Y   | j        S )The cost of the item.r9   N)r  _costr\   s    r   costzCachedCostItem.costY  sx     Y 	 	JJ!OJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	zs   %))N)r(   r)   r*   r  r  r   cached_propertyr  r   r   r   r  r  S  sG        E) ) ) !  "!  r   r  c                   B    e Zd ZdZd Ze                    e          ZdS )OptionallyCachedCostItemr9   c                 0    | xj         dz  c_         | j         S )r  r9   r  r\   s    r   get_costz!OptionallyCachedCostItem.get_costd  s    

a

zr   N)r(   r)   r*   r  r  r   r  cached_costr   r   r   r  r  a  s7        E  
 ..x88KKKr   r  c                   4    e Zd Zd Zej        d             ZdS )CachedCostItemWaitc                 ^    d| _         t                                          | _        || _        d S r  )r  r   r  r  event)r1   r  s     r   r  zCachedCostItemWait.__init__n  s'    
 &&((	


r   c                     | j                             d           | j        5  | xj        dz  c_        d d d            n# 1 swxY w Y   | j        S r  )r  r}  r  r  r\   s    r   r  zCachedCostItemWait.costs  s    
Y 	 	JJ!OJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	zs   ?AAN)r(   r)   r*   r  r   r  r  r   r   r   r  r  l  sB          
 !  "!  r   r  c                   8    e Zd ZdZd Zej        d             ZdS )CachedCostItemWithSlotsr  c                     d| _         d S r  r  r\   s    r   r  z CachedCostItemWithSlots.__init__~  s    


r   c                      t          d          )Nz!never called, slots not supportedr  r\   s    r   r  zCachedCostItemWithSlots.cost  s    >???r   N)r(   r)   r*   	__slots__r  r   r  r  r   r   r   r  r  {  sL        I   !@ @ "!@ @ @r   r  c                   t    e Zd Zd Zd Z ej                    d             Zd Zd Z	d Z
d Zd Zd	 Zd
 ZdS )TestCachedPropertyc                     t                      }|                     |j        d           |                     |j        d           d S r  )r  rO   r  r1   items     r   test_cachedzTestCachedProperty.test_cached  sC    A&&&A&&&&&r   c                 .   t                      }|                     |                                d           |                     |j        d           |                     |                                d           |                     |j        d           d S )Nr:   r@   rA   )r  rO   r  r  r  s     r   1test_cached_attribute_name_differs_from_func_namezDTestCachedProperty.test_cached_attribute_name_differs_from_func_name  s    '))!,,,)1---!,,,)1-----r   c                    t          j                    }t          |          d}t          j                    }t          j        d           	 fdt          |          D             }t          j        |          5  |	                                 d d d            n# 1 swxY w Y   t          j        |           n# t          j        |           w xY w| 
                    j        d           d S )Nr@   r  c                 @    g | ]}t          j        fd           S )c                       j         S r   )r  )r  s   r   rK   z=TestCachedProperty.test_threaded.<locals>.<listcomp>.<lambda>  s	    	 r   r  r  )r   r,  r  s     r   r   z4TestCachedProperty.test_threaded.<locals>.<listcomp>  sA         (9(9(9(9:::  r   r:   )r  r  r  r   r  r  r   r   r  r  rO   r  )r1   gonum_threadsr  r  r  s        @r   test_threadedz TestCachedProperty.test_threaded  s6   _!"%%'))d###	+   {++  G "/88                 !'****C!'****A&&&&&s0   /B> =BB> B""B> %B"&B> >Cc                     t                      }|                     t          d          5  |j         d d d            d S # 1 swxY w Y   d S )NzWNo '__dict__' attribute on 'CachedCostItemWithSlots' instance to cache 'cost' property.)r  r}  rZ   r  r  s     r   test_object_with_slotsz)TestCachedProperty.test_object_with_slots  s    &((##i
 
 	 	 II		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ?AAc                      G d dt                     } G d d|          }|                     t          d          5  |j         d d d            d S # 1 swxY w Y   d S )Nc                   .    e Zd Zej        d             ZdS )6TestCachedProperty.test_immutable_dict.<locals>.MyMetac                     dS )NTr   r\   s    r   propz;TestCachedProperty.test_immutable_dict.<locals>.MyMeta.prop  s    tr   N)r(   r)   r*   r   r  r  r   r   r   MyMetar    s1        )  *)  r   r  c                       e Zd ZdS )7TestCachedProperty.test_immutable_dict.<locals>.MyClassNr'   r   r   r   MyClassr    r  r   r  r  zkThe '__dict__' attribute on 'MyMeta' instance does not support item assignment for caching 'prop' property.)r   r}  rZ   r  )r1   r  r  s      r   test_immutable_dictz&TestCachedProperty.test_immutable_dict  s    	 	 	 	 	T 	 	 	
	 	 	 	 	 	 	 	 	 ##y
 
 	 	 LL		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                    |                      t                    5 } G d d          }ddd           n# 1 swxY w Y   |                     t          |j        j                  t          t          d                               dS )zDDisallow this case because decorated function a would not be cached.c                   2    e Zd Zej        d             ZeZdS )KTestCachedProperty.test_reuse_different_names.<locals>.ReusedCachedPropertyc                     d S r   r   r\   s    r   r>   zMTestCachedProperty.test_reuse_different_names.<locals>.ReusedCachedProperty.a  s    Dr   N)r(   r)   r*   r   r  r>   r?   r   r   r   ReusedCachedPropertyr    s2        -  .- r   r  NzLCannot assign the same cached_property to two different names ('a' and 'b').)rY   r  rO   r   rO  rP  rZ   )r1   ctxr  s      r   test_reuse_different_namesz-TestCachedProperty.test_reuse_different_names  s    |,, 	       	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	)**	hiijj	
 	
 	
 	
 	
s   599c                 B   dt           j        fd             G fdd          } G fdd          } |            } |            }|                     |j        d           |                     |j        d           |                     |j        d           d	S )
zIReusing a cached_property on different classes under the same name is OK.r   c                     dz  S r  r   )_selfcounters    r   _cpz4TestCachedProperty.test_reuse_same_name.<locals>._cp  s     qLGNr   c                       e Zd Z ZdS )2TestCachedProperty.test_reuse_same_name.<locals>.ANr(   r)   r*   cpr  s   r   r6  r            BBBr   r6  c                       e Zd Z ZdS )2TestCachedProperty.test_reuse_same_name.<locals>.BNr  r  s   r   rQ  r    r  r   rQ  r9   r:   N)r   r  rO   r  )r1   r6  rQ  r>   r?   r  r  s        @@r   test_reuse_same_namez'TestCachedProperty.test_reuse_same_name  s    		%	 	 	 	 
&	%	
	 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	 ACCACCq!!!q!!!q!!!!!r   c                     t                               d           } G d d          }||_        |                     t          d          5   |            j         d d d            d S # 1 swxY w Y   d S )Nc                     d S r   r   )r   s    r   rK   z=TestCachedProperty.test_set_name_not_called.<locals>.<lambda>  s    D r   c                       e Zd ZdS )8TestCachedProperty.test_set_name_not_called.<locals>.FooNr'   r   r   r   Foor     r  r   r  zGCannot use cached_property instance without calling __set_name__ on it.)r   r  r  r}  rZ   )r1   r  r  s      r   test_set_name_not_calledz+TestCachedProperty.test_set_name_not_called  s    ))..99	 	 	 	 	 	 	 	 ##Y
 
 	 	 CEEHH		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A((A,/A,c                 Z    |                      t          j        t          j                   d S r   )assertIsInstancer  r  r   r  r\   s    r   test_access_from_classz)TestCachedProperty.test_access_from_class  s$    n1<3OPPPPPr   c                 P    |                      t          j        j        d           d S )Nr  )rO   r  r  r  r\   s    r   test_doczTestCachedProperty.test_doc  s%    ,46MNNNNNr   N)r(   r)   r*   r  r  r   r  r  r  r  r  r  r  r  r  r   r   r   r  r    s        ' ' '
. . . 1022' ' 32'(    
 
 
" " ".  Q Q QO O O O Or   r  __main__)Or^  r.  r*  collections.abcr   	itertoolsr   r   randomr   r   r  r   r  r  ru  r  unittest.mockosr  r  r   r_  test.supportr   r   test.support.script_helperr	   r
   import_fresh_moduler   r   r   r`  r   r   r$   r   r&   r-   rP   r5   r7   r  TestCaser   r  rL   r  r  r  r!  r#  rj  r  r  r  r  r  r/  r5  r7  rG  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r(   mainr   r   r   <module>r     s}   



           " " " " " "        



                  				  				           & & & & & & ) ) ) ) ) ) 7 7 7 7 7 7    0}0:FI I I/m/<<
+-
+Ij\
J
J
J, , ,  
@ @ @	 	 	 	 	e 	 	 	( ( ( ( (u ( ( (	 	 	 	 	T 	 	 	CD CD CD CD CD CD CD CDJ
 ["DEE0$ 0$ 0$ 0$ 0$; 1 0$ 0$ FE0$f	6 	6 	6 	6 	6K!2 	6 	6 	6      ;.   	 	 	 	 	, 	 	 	 ["DEE$ $ $ $ $< $ $ FE$         M      ( ( ( ( () ( ( (Do6 o6 o6 o6 o6) o6 o6 o6d;9 ;9 ;9 ;9 ;9! ;9 ;9 ;9|LA LA LA LA LA LA LA LA^ ["DEE$ $ $ $ $*h/ $ $ FE$
/ / / / /:x0 / / /P> P> P> P> P> P> P> P>f ["DEE	
 	
 	
 	
 	
L("3 	
 	
 FE	
7 7 7 7 7\8#4 7 7 7g  g  g  g  g ) g  g  g T	 ) ) ) ) ) ) ) )P P P P P P P P&u% u% u% u% u% u% u% u%p          *       w)   h, h, h, h, h,* h, h, h,V       9 9 9 9 9 9 9 9       @ @ @ @ @ @ @ @pO pO pO pO pO* pO pO pOf zHMOOOOO r   