
    <e]d                        d dl Z d dlZd dlZd dlmZ d dlmZ  ej        ddg          Z ej        ddg          Z	 G d d	          Z
 G d
 de          Z G d d          Z G d d          Z G d dee j                  Z e j        e	d           G d dee j                              Z G d d          Z G d dee j                  Z e j        e	d           G d dee j                              Z e j        e	d           G d dee j                              Z e j        e	d           G d dee j                              Zedk    r e j                     dS dS )     N)support)import_helperoperator	_operator)blocked)freshc                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )Seq1c                     || _         d S Nlstselfr   s     )/usr/lib/python3.11/test/test_operator.py__init__zSeq1.__init__           c                 *    t          | j                  S r   lenr   r   s    r   __len__zSeq1.__len__       48}}r   c                     | j         |         S r   r   r   is     r   __getitem__zSeq1.__getitem__       x{r   c                      | j         |j         z   S r   r   r   others     r   __add__zSeq1.__add__       x%)##r   c                     | j         |z  S r   r   r!   s     r   __mul__zSeq1.__mul__       x%r   c                     || j         z  S r   r   r!   s     r   __rmul__zSeq1.__rmul__       txr   N	__name__
__module____qualname__r   r   r   r#   r&   r)    r   r   r
   r
      n              $ $ $              r   r
   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )Seq2c                     || _         d S r   r   r   s     r   r   zSeq2.__init__   r   r   c                 *    t          | j                  S r   r   r   s    r   r   zSeq2.__len__   r   r   c                     | j         |         S r   r   r   s     r   r   zSeq2.__getitem__!   r   r   c                      | j         |j         z   S r   r   r!   s     r   r#   zSeq2.__add__#   r$   r   c                     | j         |z  S r   r   r!   s     r   r&   zSeq2.__mul__%   r'   r   c                     || j         z  S r   r   r!   s     r   r)   zSeq2.__rmul__'   r*   r   Nr+   r/   r   r   r2   r2      r0   r   r2   c                       e Zd Zd ZdS )BadIterablec                     t           r   )ZeroDivisionErrorr   s    r   __iter__zBadIterable.__iter__+   s    r   N)r,   r-   r.   r=   r/   r   r   r:   r:   *   s#                 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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 )+OperatorTestCasec                 0   | j         }t          |j                  }t                      }t          |          D ]F}|                    d          rt          ||          }|j        dv r|                    |           G|                     ||           d S )N__)r   r   )	moduleset__all__vars
startswithgetattrr-   addassertSetEqual)r   r   
actual_allcomputed_allnamevalues         r   test___all__zOperatorTestCase.test___all__0   s    ;)**
uuNN 	' 	'Dt$$ Hd++E#<<<  &&&L*55555r   c                    | j         }|                     t          |j                   |                     t          |j        dd           |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S 	Ny              ?y               @   r                 ?          @)rB   assertRaises	TypeErrorltassertFalse
assertTruer   r   s     r   test_ltzOperatorTestCase.test_lt<   s   ;)X[111)X["b999Q**+++Q,,---Q**+++Q,,---Aq))***As++,,,,,r   c                    | j         }|                     t          |j                   |                     t          |j        dd           |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S rP   )rB   rV   rW   lerY   rZ   r[   s     r   test_lezOperatorTestCase.test_leG   s   ;)X[111)X["b999Q**+++Q,,---Aq))***As++,,,Aq))***As++,,,,,r   c                    | j         } G d dt                    }|                     t          |j                   |                     t
          |j         |             |                       |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S )	Nc                       e Zd Zd ZdS )#OperatorTestCase.test_eq.<locals>.Cc                     t           r   SyntaxErrorr!   s     r   __eq__z*OperatorTestCase.test_eq.<locals>.C.__eq__U       !!r   N)r,   r-   r.   rf   r/   r   r   Crb   T   #        " " " " "r   rh   rQ   r   rR   rS   rT   rU   )rB   objectrV   rW   eqre   rY   rZ   r   r   rh   s      r   test_eqzOperatorTestCase.test_eqR   sC   ;	" 	" 	" 	" 	" 	" 	" 	" 	)X[111+x{AACC===Q**+++Q,,---Aq))***As++,,,Q**+++Q,,-----r   c                    | j         } G d dt                    }|                     t          |j                   |                     t
          |j         |             |                       |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S )	Nc                       e Zd Zd ZdS )#OperatorTestCase.test_ne.<locals>.Cc                     t           r   rd   r!   s     r   __ne__z*OperatorTestCase.test_ne.<locals>.C.__ne__c   rg   r   N)r,   r-   r.   rr   r/   r   r   rh   rp   b   ri   r   rh   rQ   r   rR   rS   rT   rU   )rB   rj   rV   rW   nere   rZ   rY   rl   s      r   test_nezOperatorTestCase.test_ne`   s?   ;	" 	" 	" 	" 	" 	" 	" 	" 	)X[111+x{AACC===Aq))***As++,,,Q**+++Q,,---Aq))***As++,,,,,r   c                    | j         }|                     t          |j                   |                     t          |j        dd           |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S rP   )rB   rV   rW   gerZ   rY   r[   s     r   test_gezOperatorTestCase.test_gen   s   ;)X[111)X["b999Aq))***As++,,,Aq))***As++,,,Q**+++Q,,-----r   c                    | j         }|                     t          |j                   |                     t          |j        dd           |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     |                     |                    dd                     d S rP   )rB   rV   rW   gtrZ   rY   r[   s     r   test_gtzOperatorTestCase.test_gty   s   ;)X[111)X["b999Aq))***As++,,,Q**+++Q,,---Q**+++Q,,-----r   c                 :   | j         }|                     t          |j                   |                     t          |j        d            |                     |                    d          d           |                     |                    d          d           d S )NrQ   )rB   rV   rW   absassertEqualr[   s     r   test_abszOperatorTestCase.test_abs   s    ;)X\222)X\4888b))1---a!,,,,,r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )N         )rB   rV   rW   rH   r~   r[   s     r   test_addzOperatorTestCase.test_add   g    ;)X\222)X\4>>>a++Q/////r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )N   
   )rB   rV   rW   and_r~   r[   s     r   test_bitwise_andz!OperatorTestCase.test_bitwise_and   sg    ;)X]333)X]D$???sC00#66666r   c                    | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           |                     |                    ddgddg          g d           |                     |                    t          d	d
g          t          dg                    g d           |                     |                    t          d	d
g          t          dg                    g d           |                     t          |j        dd           d S )NpythonpythonrQ   rT   r   r   )rQ   rT   r   r         r   )r   r   r         )rB   rV   rW   concatr~   r
   r2   r[   s     r   test_concatzOperatorTestCase.test_concat   s'   ;)X_555)X_dDAAAv66AAA!Q!Q88,,,GGGq!ftQCyyAA999MMMq!ftQCyyAA999MMM)X_b"=====r   c                 x   | j         }|                     t          |j                   |                     t          |j        d d            |                     t          |j        t                      d           |                     |                    g dd          d           |                     |                    g dd          d           t          d          }|                     |                    ||dg|          d           |                     |                    i di dgi           d           d S )	NrQ   )rQ   rT   rQ   r   rQ   r   r   r   r   nan   rT   )rB   rV   rW   countOfr<   r:   r~   float)r   r   r   s      r   test_countOfzOperatorTestCase.test_countOf   s&   ;)X%5666)X%5tTBBB+X-={}}aPPP))*<*<*<a@@!DDD))*<*<*<a@@!DDDEll))3R.#>>BBB))2q"a."==qAAAAAr   c                 $   | j         }g d}|                     t          |j        |           |                     t          |j        |d            |                     |                    |d                     |                     |g d           d S )Nr   r   rT   rQ   rQ   )r   rT   rQ   )rB   rV   rW   delitemassertIsNoner~   r   r   as      r   test_delitemzOperatorTestCase.test_delitem   s    ;LL)X%5q999)X%5q$???(**1a00111III&&&&&r   c                     | j         }|                     t          |j        d           |                     t          |j        d d            |                     |                    dd          d           d S )Nr   rT   )rB   rV   rW   floordivr~   r[   s     r   test_floordivzOperatorTestCase.test_floordiv   sm    ;)X%6:::)X%6dCCC**1a00!44444r   c                     | j         }|                     t          |j        d           |                     t          |j        d d            |                     |                    dd          d           d S )Nr   rT   g      @)rB   rV   rW   truedivr~   r[   s     r   test_truedivzOperatorTestCase.test_truediv   sm    ;)X%5q999)X%5tTBBB))!Q//55555r   c                 
   | j         }t          d          }|                     t          |j                   |                     t          |j        |d            |                     |                    |d          d           d S )Nr   rT   )rB   rangerV   rW   getitemr~   r   s      r   test_getitemzOperatorTestCase.test_getitem   sv    ;"II)X%5666)X%5q$???))!Q//33333r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     t          |j        t                      d           |                     |                    g dd          d           |                     t          |j        g dd           t          d          }|                     |                    ||dg|          d           |                     |                    i di dgi           d           t          d          }|                     |                    |d	          d           |                     t          |          d
           d S )NrQ   r   r   r   r   r   rT   z:leave the iterator at exactly the position after the matchr   v)rB   rV   rW   indexOfr<   r:   r~   
ValueErrorr   iternext)r   r   r   its       r   test_indexOfzOperatorTestCase.test_indexOf   sg   ;)X%5666)X%5tTBBB+X-={}}aPPP)),,,::A>>>*h&6aHHHEll))3R.#>>BBB))2q"a."==qAAANOO))"c22A666b3'''''r   c                     | j         }|                     t          |j                   |                     t          |j        d            |                     |                    d          d           d S )Nr   )rB   rV   rW   invertr~   invr[   s     r   test_invertzOperatorTestCase.test_invert   sa    ;)X_555)X_d;;;a"-----r   c                    | j         }|                     t          |j                   |                     t          |j        d d           |                     |                    dd          d           |                     |                    dd          d           |                     t
          |j        dd           d S )N*   r   rQ   r   r   rT   r|   )rB   rV   rW   lshiftr~   r   r[   s     r   test_lshiftzOperatorTestCase.test_lshift   s    ;)X_555)X_dB???A..333A..222*hoq"=====r   c                     | j         }|                     t          |j                   |                     t          |j        d d           |                     |                    dd          d           d S )Nr   r   rT   rQ   )rB   rV   rW   modr~   r[   s     r   test_modzOperatorTestCase.test_mod   sg    ;)X\222)X\4<<<a++Q/////r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )Nr   rT   r   )rB   rV   rW   mulr~   r[   s     r   test_mulzOperatorTestCase.test_mul   sg    ;)X\222)X\4>>>a++R00000r   c                     | j         }|                     t          |j                   |                     t          |j        dd            G d d          }|                      |            dz  d           d S )Nr   c                       e Zd Zd ZdS )'OperatorTestCase.test_matmul.<locals>.Mc                     |dz
  S )NrQ   r/   r!   s     r   
__matmul__z2OperatorTestCase.test_matmul.<locals>.M.__matmul__   s    qy r   N)r,   r-   r.   r   r/   r   r   Mr      s#        ! ! ! ! !r   r   )   )rB   rV   rW   matmulr~   )r   r   r   s      r   test_matmulzOperatorTestCase.test_matmul   s    ;)X_555)X_b"===	! 	! 	! 	! 	! 	! 	! 	! 	r2&&&&&r   c                    | j         }|                     t          |j                   |                     t          |j        d            |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           d S Nr   r   r   )rB   rV   rW   negr~   r[   s     r   test_negzOperatorTestCase.test_neg   s    ;)X\222)X\4888a"---b))1---a!,,,b))1-----r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )Nr   r   r   )rB   rV   rW   or_r~   r[   s     r   test_bitwise_orz OperatorTestCase.test_bitwise_or  g    ;)X\222)X\4>>>c3//55555r   c                    | j         }|                     t          |j                   |                     t          |j        d            |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           d S r   )rB   rV   rW   posr~   r[   s     r   test_poszOperatorTestCase.test_pos	  s    ;)X\222)X\4888a!,,,b))2...a!,,,b))1-----r   c                 t   | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           |                     t          |j        d           |                     t          |j        ddd           d S )Nr   r      rQ   rT   )rB   rV   rW   powr~   r[   s     r   test_powzOperatorTestCase.test_pow  s    ;)X\222)X\4>>>a**D111)X\1555)X\1a;;;;;r   c                    | j         }|                     t          |j                   |                     t          |j        d d           |                     |                    dd          d           |                     |                    dd          d           |                     t
          |j        dd           d S )Nr   r   rQ   rT   r   r|   )rB   rV   rW   rshiftr~   r   r[   s     r   test_rshiftzOperatorTestCase.test_rshift  s    ;)X_555)X_dB???A..222A..222*hoq"=====r   c                    | j         }|                     t          |j                   |                     t          |j        d d            |                     t          |j        t                      d           |                     |                    t          d          d                     |                     |                    t          d          d                     d S )NrQ   r   rT   r   )	rB   rV   rW   containsr<   r:   rZ   r   rY   r[   s     r   test_containszOperatorTestCase.test_contains"  s    ;)X%6777)X%6dCCC+X->qQQQ))%((A66777**588Q7788888r   c                    | j         }t          t          d                    }|                     t          |j        |           |                     t          |j        |d d            |                     |                    |dd                     |                     |g d           |                     t          |j        |dd           d S )Nr   r   rT   )rT   rQ   rT   r   )	rB   listr   rV   rW   setitemr   r~   
IndexErrorr   s      r   test_setitemzOperatorTestCase.test_setitem*  s    ;qNN)X%5q999)X%5q$EEE(**1a33444III&&&*h&61a@@@@@r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )Nr   rT   r   )rB   rV   rW   subr~   r[   s     r   test_subzOperatorTestCase.test_sub3  r   r   c                    | j         } G d dt                    }|                     t          |j                   |                     t
          |j         |                       |                     |                    d                     |                     |                    dg                     |                     |                    d                     |                     |                    g                      d S )Nc                       e Zd Zd ZdS )&OperatorTestCase.test_truth.<locals>.Cc                     t           r   rd   r   s    r   __bool__z/OperatorTestCase.test_truth.<locals>.C.__bool__<  rg   r   N)r,   r-   r.   r   r/   r   r   rh   r   ;  ri   r   rh   r   r   )rB   rj   rV   rW   truthre   rZ   rY   rl   s      r   
test_truthzOperatorTestCase.test_truth9  s    ;	" 	" 	" 	" 	" 	" 	" 	" 	)X^444+x~qqss;;;q))***s++,,,**+++++,,,,,r   c                     | j         }|                     t          |j                   |                     t          |j        d d            |                     |                    dd          d           d S )N      r   )rB   rV   rW   xorr~   r[   s     r   test_bitwise_xorz!OperatorTestCase.test_bitwise_xorE  r   r   c                 *   | j         }dx}}|d d         |dd          z   }|                     t          |j                   |                     |                    ||                     |                     |                    ||                     d S Nxyzpdqr   )rB   rV   rW   is_rZ   rY   r   r   r   bcs        r   test_iszOperatorTestCase.test_isK  s    ;AbqbEAabbEM)X\222Q**+++a**+++++r   c                 *   | j         }dx}}|d d         |dd          z   }|                     t          |j                   |                     |                    ||                     |                     |                    ||                     d S r   )rB   rV   rW   is_notrY   rZ   r   s        r   test_is_notzOperatorTestCase.test_is_notS  s    ;AbqbEAabbEM)X_555A..///!,,-----r   c                 x   | j         } G d d          } |            }d|_        |                    d          }|                      ||          d           |                     t
          |           |                     t
          ||d           |                     t
          ||d           |                    d          }|                     t          ||           |                     t
          |j        d           |                     t
          |j                    |            }d	|_        d
|_        d|_	        |                      |                    ddd          |          d           |                     t
          |j        d            G d dt                    }|                     t          |                    d           |                        |            }d|_         |            |_        d|j        _        |                    d          }|                      ||          d           |                     t          ||j                   |                    dd          }|                      ||          d           |                    ddd          }|                     t          ||           |                    d          }|                     t          ||           |                    d          }|                     t          ||            |            |j        _        d|j        j        _        |                    d          }|                      ||          d           |                    ddd          }|                      ||          d           d S )Nc                       e Zd ZdS )+OperatorTestCase.test_attrgetter.<locals>.ANr,   r-   r.   r/   r   r   Ar  ]          Dr   r  arthurrL   dent)surnamerankrT   XYZxzy)r
  r  r  )r  r/   r  c                       e Zd Zd ZdS )+OperatorTestCase.test_attrgetter.<locals>.Cc                     t           r   rd   r   rL   s     r   __getattr__z7OperatorTestCase.test_attrgetter.<locals>.C.__getattr__t  rg   r   N)r,   r-   r.   r  r/   r   r   rh   r  s  ri   r   rh   foothomasz
child.name)r  r  zchild.child.namezchild.z.childjohnson)r  r  r  )rB   rL   
attrgetterr~   rV   rW   AttributeErrorr  r  r  rj   re   child)r   r   r  r   frecordrh   s          r   test_attrgetterz OperatorTestCase.test_attrgetter[  s   ;	 	 	 	 	 	 	 	ACC''1x((()Q''')Q6222)Q6:::''.!Q///)X%8!<<<)X%8999 9,,SS99&AA?SSS)X%8.III	" 	" 	" 	" 	" 	" 	" 	" 	+x':':5'A'A1133GGG ACC!##--1x(((.!QW55555134446HII.!Q///)).!Q///)).!Q///& 2331y)))6HII1>?????r   c           	      B   | j         }d}|                    d          }|                      ||          d           |                     t          |           |                     t          ||d           |                     t          ||d           |                    d          }|                     t
          ||            G d dt                    }|                     t          |                    d           |                       |                    d	          }|                     t          ||           |                     t          |j                   t          d
          }|                    d          }|                      ||          d
           |                    d          }|                     t          ||           g d}|                    d          }|                     t          t          ||                    g d           |                     t          ||          g d           t          t          t          t          d                              }|                      |                    ddd          |          d           |                     t          |                    ddd          |           t          d          }	|                      |                    d          |	          d           |                      |                    t!          dd                    |	          d            G d dt                    }
|                      |                    d           |
d                    d           |                      |                    d          g d           d           |                      |                    d          t          d!d"                    d!           d S )#NABCDErT   rh   r   )sizer   c                       e Zd Zd ZdS )+OperatorTestCase.test_itemgetter.<locals>.Cc                     t           r   rd   r  s     r   r   z7OperatorTestCase.test_itemgetter.<locals>.C.__getitem__  rg   r   N)r,   r-   r.   r   r/   r   r   rh   r"    ri   r   r   rL   val)keyr%  nonkey)appler   bananarT   pearr   orangerQ   rQ   )r   rT   r   rQ   )r-  r)  r'  r+     r   )2105r  abcder|   er   )r   dc                       e Zd Z	 dS )+OperatorTestCase.test_itemgetter.<locals>.TNr  r/   r   r   Tr7    s        Dr   r8  r   abcr   )r   r   r   d      )rB   
itemgetterr~   rV   rW   r   rj   re   dictKeyErrorr   mapsortedstrr   tupleslice)r   r   r   r  rh   r5  	inventorygetcountdatatr8  s              r   test_itemgetterz OperatorTestCase.test_itemgetter  s   ;""1s###)Q''')Q1---)Q222##*a+++	" 	" 	" 	" 	" 	" 	" 	" 	+x':':2'>'>DDD'')Q***)X%8999UOOO&&1u%%%))(Aq))) NMM	&&q))c(I6677FFF	x888EEE	G 	G 	G CU2YY''((4,,Qr!44T::<LMMM)X%8%8C%C%CTJJJ 'NN0,,R0033S9999,,U1a[[99!<<jIII	 	 	 	 	 	 	 	 	/,,Q//%993???/,,Q//@@#FFF/,,Q//c3@@#FFFFFr   c                    | j         }|                     t          |j                   |                     t          |j        d            G d d          } |            }|                    d          }|                     t          ||           |                    ddd          }|                      ||          d           |                     t          |           |                     t          ||d           |                     t          ||d           |                    d	          }|                      ||          d
           |                     t          |||           |                    d	d          }|                      ||          d           |                    ddd          }|                      ||          d           d S )Nr   c                   "    e Zd Zd ZddZd ZdS )-OperatorTestCase.test_methodcaller.<locals>.Ac                 $    |d         |d         z   S Nr   rQ   r/   r   argskwdss      r   r  z1OperatorTestCase.test_methodcaller.<locals>.A.foo      Awa((r   r   c                     |S r   r/   r   r  s     r   barz1OperatorTestCase.test_methodcaller.<locals>.A.bar      r   c                  "    |d         |d         fS NrL   r   r/   rO  rP  s     r   bazz1OperatorTestCase.test_methodcaller.<locals>.A.baz      F|T&\11r   Nr   r,   r-   r.   r  rT  rY  r/   r   r   r  rK    F        ) ) )   2 2 2 2 2r   r  r  rQ   rT   r   )spamrT  r   r   r  rY  r^  eggs)rL   r   )r^  r`  )rB   rV   rW   methodcallerr   r~   )r   r   r  r   r  s        r   test_methodcallerz"OperatorTestCase.test_methodcaller  s   ;)X%:;;;)X%:B???	2 	2 	2 	2 	2 	2 	2 	2 ACC!!%((*a+++!!%A..1q!!!)Q''')Q1---)Q222!!%((1r""")Q1---!!%1!--1q!!!!!%f6!BB1/00000r   c                    | j         } G d 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           |                     |                    |d          d           |                     |                    ||          d           d S )Nc                   b    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S )(OperatorTestCase.test_inplace.<locals>.Cc                     dS )Niaddr/   r!   s     r   __iadd__z1OperatorTestCase.test_inplace.<locals>.C.__iadd__      66r   c                     dS )Niandr/   r!   s     r   __iand__z1OperatorTestCase.test_inplace.<locals>.C.__iand__  ri  r   c                     dS )N	ifloordivr/   r!   s     r   __ifloordiv__z6OperatorTestCase.test_inplace.<locals>.C.__ifloordiv__  s    ;;r   c                     dS )Nilshiftr/   r!   s     r   __ilshift__z4OperatorTestCase.test_inplace.<locals>.C.__ilshift__      99r   c                     dS )Nimodr/   r!   s     r   __imod__z1OperatorTestCase.test_inplace.<locals>.C.__imod__  ri  r   c                     dS )Nimulr/   r!   s     r   __imul__z1OperatorTestCase.test_inplace.<locals>.C.__imul__  ri  r   c                     dS )Nimatmulr/   r!   s     r   __imatmul__z4OperatorTestCase.test_inplace.<locals>.C.__imatmul__  rs  r   c                     dS )Niorr/   r!   s     r   __ior__z0OperatorTestCase.test_inplace.<locals>.C.__ior__  s    55r   c                     dS )Nipowr/   r!   s     r   __ipow__z1OperatorTestCase.test_inplace.<locals>.C.__ipow__  ri  r   c                     dS )Nirshiftr/   r!   s     r   __irshift__z4OperatorTestCase.test_inplace.<locals>.C.__irshift__  rs  r   c                     dS )Nisubr/   r!   s     r   __isub__z1OperatorTestCase.test_inplace.<locals>.C.__isub__  ri  r   c                     dS )Nitruedivr/   r!   s     r   __itruediv__z5OperatorTestCase.test_inplace.<locals>.C.__itruediv__  s    ::r   c                     dS )Nixorr/   r!   s     r   __ixor__z1OperatorTestCase.test_inplace.<locals>.C.__ixor__  ri  r   c                     dS )Nr   r/   r!   s     r   r   z4OperatorTestCase.test_inplace.<locals>.C.__getitem__  s    r   N)r,   r-   r.   rh  rl  ro  rr  rv  ry  r|  r  r  r  r  r  r  r   r/   r   r   rh   re    s        999999>>><<<999999<<<888999<<<999===99922222r   rh   r   rg  rk  rn  rq  ru  rx  r{  r~  r  r  r  r  r  )rB   rj   r~   rg  rk  rn  rq  ru  rx  r{  r~  r  r  r  r  r  iconcat)r   r   rh   r   s       r   test_inplacezOperatorTestCase.test_inplace  sJ   ;	3 	3 	3 	3 	3 	3 	3 	3 ACCAq116:::Aq116:::++Aq11;???))Aq119===Aq116:::Aq116:::))Aq119===Aq115999Aq116:::))Aq119===Aq116:::**Aq11:>>>Aq116:::))Aq116:::::r   c                 .   | j         } G d dt                    }|                     |                    g d          d           |                     |                    t	          g d                    d           |                     |                     |d                    d           |                     |                     |t
                    d          d           |                     |                     |t                    d          d           |                     t                    5  |                     |d	                     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  |                     |t                               d d d            d S # 1 swxY w Y   d S )Nc                       e Zd Zd Zd ZdS ),OperatorTestCase.test_length_hint.<locals>.Xc                     || _         d S r   )rM   )r   rM   s     r   r   z5OperatorTestCase.test_length_hint.<locals>.X.__init__  s    "


r   c                 T    t          | j                  t           u r| j        | j        S r   )typerM   r   s    r   __length_hint__z<OperatorTestCase.test_length_hint.<locals>.X.__length_hint__  s'    
##t++*$:%r   N)r,   r-   r.   r   r  r/   r   r   r
  r    s2        # # #& & & & &r   r
  rT   r   )rQ   rT   r   r   r   r   r9  )
rB   rj   r~   length_hintr   NotImplementedrW   rV   r   LookupError)r   r   r
  s      r   test_length_hintz!OperatorTestCase.test_length_hint  s   ;	& 	& 	& 	& 	& 	& 	& 	& 	--b!44a888--d999oo>>BBB--aadd33Q777--aa.?.?CCQGGG--aa	llB??DDDy)) 	+ 	+  5***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+z** 	( 	(  2'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	({++ 	1 	1  ;000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1s6   9E$$E(+E(	F44F8;F8$H

HHc           	         | j         }d }|                     |                    |          di f           |                     |                    |dd          di f           |                     |                    |dd          ddddf           |                     |                    |dddd          ddddf           d S )	Nc                  
    | |fS r   r/   )rO  kwargss     r   funcz(OperatorTestCase.test_call.<locals>.func  s    $,#6r   r/   r   rQ   )r   rQ   rT   r   )r   obj)rB   r~   call)r   r   r  s      r   	test_callzOperatorTestCase.test_call  s    ;666t,,r2h777tQ22VRLAAAtqa88Aa001	3 	3 	3tQQA>> !"4"45	7 	7 	7 	7 	7r   c                     | j         }d t          |          D             }|D ]T}t          ||          }t          |d|                    d          z   dz   d           }|r|                     ||           Ud S )Nc                 <    g | ]}|                     d           |S )_)rF   ).0rL   s     r   
<listcomp>z<OperatorTestCase.test_dunder_is_original.<locals>.<listcomp>'  s)    LLL$ts7K7KLLLLr   rA   r  )rB   dirrG   stripassertIs)r   r   namesrL   origdunders         r   test_dunder_is_originalz(OperatorTestCase.test_dunder_is_original$  s    ;LL#h--LLL 	, 	,D8T**DXtdjjoo'='DdKKF ,fd+++		, 	,r   N),r,   r-   r.   rN   r\   r_   rm   rt   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  rH  rb  r  r  r  r  r/   r   r   r?   r?   /   s       
6 
6 
6	- 	- 	-	- 	- 	-. . .- - -	. 	. 	.	. 	. 	.- - -0 0 07 7 7> > >B B B' ' '5 5 56 6 64 4 4( ( (. . .> > >0 0 01 1 1' ' '. . .6 6 6. . .< < <> > >9 9 9A A A0 0 0
- 
- 
-6 6 6, , ,. . .3@ 3@ 3@j1G 1G 1Gf1 1 16; ; ;B1 1 12
7 
7 
7, , , , ,r   r?   c                       e Zd ZeZdS )PyOperatorTestCaseN)r,   r-   r.   py_operatorrB   r/   r   r   r  r  .  s        FFFr   r  zrequires _operatorc                       e Zd ZeZdS )COperatorTestCaseN)r,   r-   r.   
c_operatorrB   r/   r   r   r  r  1  s        FFFr   r  c                   &    e Zd Zd Zd Zd Zd ZdS )OperatorPickleTestCasec                 L   t          j        t          j        d| j                  5  t          j        ||          }d d d            n# 1 swxY w Y   t          j        t          j        d| j                  5  t          j        |          cd d d            S # 1 swxY w Y   d S )Nr   )	r   	swap_itemsysmodulesrB   pickledumpsmodule2loads)r   r  protopickleds       r   copyzOperatorPickleTestCase.copy7  s   s{JDD 	/ 	/l3..G	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s{JEE 	) 	)<((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s#   AAA8BB Bc                 V   | j         j        } G d d          } |            }d|_        d|_        d|_         |            |_         |            |j        _        d|j        j        _        t          t          j
        dz             D ]}|                     |          5   |d	          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |d	d
d          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |d          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                     d d d            n# 1 swxY w Y   d S )Nc                       e Zd ZdS )1OperatorPickleTestCase.test_attrgetter.<locals>.ANr  r/   r   r   r  r  ?  r  r   r  r
  r  r  VrQ   r  r  r  r  zt.u.v)rB   r  r  r  r  rG  ur   r   r  HIGHEST_PROTOCOLsubTestr  r~   repr)r   r  r  r   r  r  f2s          r   r  z&OperatorPickleTestCase.test_attrgetter=  sN   [+
	 	 	 	 	 	 	 	ACCacc62Q677 	. 	.EE** . .JsOOYYq%((  b477333  A!---JsC--YYq%((  b477333  A!---Jw''YYq%((  b477333  A!---. . . . . . . . . . . . . . .	. 	.s   "E.HH 	#H 	c                    | j         j        }d}t          t          j        dz             D ]%}|                     |          5   |d          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |ddd          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                     d d d            n# 1 swxY w Y   'd S )Nr  rQ   r  rT   r   r   )	rB   r<  r   r  r  r  r  r~   r  )r   r<  r   r  r  r  s         r   rH  z&OperatorPickleTestCase.test_itemgetterY  sz   [+
62Q677 
	. 
	.EE** 	. 	.JqMMYYq%((  b477333  A!---Jq!Q''YYq%((  b477333  A!---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.
	. 
	.s   C5EE		E		c                 `   | j         j        } G d d          } |            }t          t          j        dz             D ]}|                     |          5   |d          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |ddd          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |dd	          }|                     ||          }|                     t          |          t          |                     |                      ||           ||                      |d
dd          }|                     ||          }|                      ||           ||                     d d d            n# 1 swxY w Y   d S )Nc                   "    e Zd Zd ZddZd ZdS )3OperatorPickleTestCase.test_methodcaller.<locals>.Ac                 $    |d         |d         z   S rM  r/   rN  s      r   r  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.fook  rQ  r   r   c                     |S r   r/   rS  s     r   rT  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.barm  rU  r   c                  "    |d         |d         fS rW  r/   rX  s     r   rY  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.bazo  rZ  r   Nr[  r\  r/   r   r   r  r  j  r]  r   r  rQ   r  rT  r  rT   r   r_  rY  r`  r^  r  )	rB   ra  r   r  r  r  r  r~   r  )r   ra  r  r   r  r  r  s          r   rb  z(OperatorPickleTestCase.test_methodcallerh  sj   {/	2 	2 	2 	2 	2 	2 	2 	2 ACC62Q677 	. 	.EE** . . L''YYq%((  b477333  A!--- L1--YYq%((  b477333  A!--- L!,,,YYq%((  b477333  A!--- LV&AAAYYq%((  A!---%. . . . . . . . . . . . . . .	. 	.s   F<H!!H%	(H%	N)r,   r-   r.   r  r  rH  rb  r/   r   r   r  r  6  sP        ) ) ). . .8. . .. . . . .r   r  c                       e Zd ZeZeZdS )PyPyOperatorPickleTestCaseN)r,   r-   r.   r  rB   r  r/   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )PyCOperatorPickleTestCaseN)r,   r-   r.   r  rB   r  r  r/   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )CPyOperatorPickleTestCaseN)r,   r-   r.   r  rB   r  r  r/   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )CCOperatorPickleTestCaseN)r,   r-   r.   r  rB   r  r/   r   r   r  r    s        FGGGr   r  __main__)unittestr  r  testr   test.supportr   import_fresh_moduler  r  r
   rj   r2   r:   r?   TestCaser  
skipUnlessr  r  r  r  r  r  r,   mainr/   r   r   <module>r     s"     



       & & & & & & 0m/
9DG G G.].z6A]D D D
                        6                     
}, }, }, }, }, }, }, },~    )8+<    Z!566    ((*;   76O. O. O. O. O. O. O. O.b    !79J    Z!566     68I   76 Z!566     68I   76 Z!566    5x7H   76
 zHMOOOOO r   