
    5\hj                        d dl Z d dlZd dlZd dlmZ d dlm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)Decimal)Fraction)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     </opt/python-3.11.14/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-   r1   r   r   r4   r4      r2   r   r4   c                       e Zd Zd ZdS )BadIterablec                     t           r   )ZeroDivisionErrorr   s    r   __iter__zBadIterable.__iter__-   s    r   N)r.   r/   r0   r?   r1   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* 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__2   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                 ?          @)rD   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 rR   )rD   rX   rY   ler[   r\   r]   s     r   test_lezOperatorTestCase.test_leI   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__W       !!r   N)r.   r/   r0   rh   r1   r   r   Crd   V   #        " " " " "r   rj   rS   r   rT   rU   rV   rW   )rD   objectrX   rY   eqrg   r[   r\   r   r   rj   s      r   test_eqzOperatorTestCase.test_eqT   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   rf   r#   s     r   __ne__z*OperatorTestCase.test_ne.<locals>.C.__ne__e   ri   r   N)r.   r/   r0   rt   r1   r   r   rj   rr   d   rk   r   rj   rS   r   rT   rU   rV   rW   )rD   rl   rX   rY   nerg   r\   r[   rn   s      r   test_nezOperatorTestCase.test_neb   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 rR   )rD   rX   rY   ger\   r[   r]   s     r   test_gezOperatorTestCase.test_gep   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 rR   )rD   rX   rY   gtr\   r[   r]   s     r   test_gtzOperatorTestCase.test_gt{   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 )NrS   )rD   rX   rY   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         )rD   rX   rY   rJ   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   
   )rD   rX   rY   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pythonrS   rV   r   r   )rS   rV   r   r         r   )r   r   r         )rD   rX   rY   concatr   r   r4   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 )	NrS   )rS   rV   rS   r   rS   r   r   r   r   nan   rV   )rD   rX   rY   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   rV   rS   rS   )r   rV   rS   )rD   rX   rY   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   rV   )rD   rX   rY   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   rV   g      @)rD   rX   rY   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   rV   )rD   rangerX   rY   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 )NrS   r   r   r   r   r   rV   z:leave the iterator at exactly the position after the matchr   v)rD   rX   rY   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   )rD   rX   rY   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   rS   r   r   rV   r~   )rD   rX   rY   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   rV   rS   )rD   rX   rY   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   rV   r   )rD   rX   rY   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 NrS   r1   r#   s     r   
__matmul__z2OperatorTestCase.test_matmul.<locals>.M.__matmul__   s    qy r   N)r.   r/   r0   r   r1   r   r   Mr      s#        ! ! ! ! !r   r   )   )rD   rX   rY   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   )rD   rX   rY   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   )rD   rX   rY   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   )rD   rX   rY   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      rS   rV   )rD   rX   rY   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   rS   rV   r   r~   )rD   rX   rY   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 )NrS   r   rV   r   )	rD   rX   rY   containsr>   r<   r\   r   r[   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   rV   )rV   rS   rV   r   )	rD   listr   rX   rY   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   rV   r   )rD   rX   rY   subr   r]   s     r   test_subzOperatorTestCase.test_sub5  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   rf   r   s    r   __bool__z/OperatorTestCase.test_truth.<locals>.C.__bool__>  ri   r   Nr.   r/   r0   r   r1   r   r   rj   r   =  rk   r   rj   r   r   )rD   rl   rX   rY   truthrg   r\   r[   rn   s      r   
test_truthzOperatorTestCase.test_truth;  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   )rD   rX   rY   xorr   r]   s     r   test_bitwise_xorz!OperatorTestCase.test_bitwise_xorG  r   r   c                 *   | j         }dx}}|d d         |dd          z   }|                     t          |j                   |                     |                    ||                     |                     |                    ||                     d S Nxyzpdqr   )rD   rX   rY   is_r\   r[   r   r   r   bcs        r   test_iszOperatorTestCase.test_isM  s    ;AbqbEAabbEM)X\222Q**+++a**+++++r   c                 *   | j         }dx}}|d d         |dd          z   }|                     t          |j                   |                     |                    ||                     |                     |                    ||                     d S r   )rD   rX   rY   is_notr[   r\   r   s        r   test_is_notzOperatorTestCase.test_is_notU  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/   r0   r1   r   r   Ar  _          Dr   r  arthurrN   dent)surnamerankrV   XYZxzy)r  r  r  )r  r1   r  c                       e Zd Zd ZdS )+OperatorTestCase.test_attrgetter.<locals>.Cc                     t           r   rf   r   rN   s     r   __getattr__z7OperatorTestCase.test_attrgetter.<locals>.C.__getattr__v  ri   r   N)r.   r/   r0   r  r1   r   r   rj   r  u  rk   r   rj   foothomasz
child.name)r
  r  zchild.child.namezchild.z.childjohnson)r
  r  r  )rD   rN   
attrgetterr   rX   rY   AttributeErrorr  r  r  rl   rg   child)r   r   r  r   frecordrj   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ABCDErV   rj   r   )sizer   c                       e Zd Zd ZdS )+OperatorTestCase.test_itemgetter.<locals>.Cc                     t           r   rf   r  s     r   r    z7OperatorTestCase.test_itemgetter.<locals>.C.__getitem__  ri   r   N)r.   r/   r0   r    r1   r   r   rj   r&    rk   r   r   rN   val)keyr)  nonkey)appler   bananarV   pearr   orangerS   rS   )r   rV   r   rS   )r1  r-  r+  r/     r   )2105r  abcder~   er   )r   dc                       e Zd ZdZdS )+OperatorTestCase.test_itemgetter.<locals>.TzTuple subclassN)r.   r/   r0   __doc__r1   r   r   Tr;    s        Dr   r=  r   abcr   )r   r   r   d      )rD   
itemgetterr   rX   rY   r   rl   rg   dictKeyErrorr   mapsortedstrr   tupleslice)r   r   r   r  rj   r9  	inventorygetcountdatatr=  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   rS   r1   r   argskwdss      r   r  z1OperatorTestCase.test_methodcaller.<locals>.A.foo      Awa((r   r   c                     |S r   r1   r   r  s     r   barz1OperatorTestCase.test_methodcaller.<locals>.A.bar      r   c                  "    |d         |d         fS NrN   r   r1   rT  rU  s     r   bazz1OperatorTestCase.test_methodcaller.<locals>.A.baz      F|T&\11r   Nr   r.   r/   r0   r  rY  r^  r1   r   r   r  rP    F        ) ) )   2 2 2 2 2r   r  r  rS   rV   r   )spamrY  r   r   r  r^  rc  eggs)rN   r   )rc  re  )rD   rX   rY   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iaddr1   r#   s     r   __iadd__z1OperatorTestCase.test_inplace.<locals>.C.__iadd__      66r   c                     dS )Niandr1   r#   s     r   __iand__z1OperatorTestCase.test_inplace.<locals>.C.__iand__  rn  r   c                     dS )N	ifloordivr1   r#   s     r   __ifloordiv__z6OperatorTestCase.test_inplace.<locals>.C.__ifloordiv__  s    ;;r   c                     dS )Nilshiftr1   r#   s     r   __ilshift__z4OperatorTestCase.test_inplace.<locals>.C.__ilshift__      99r   c                     dS )Nimodr1   r#   s     r   __imod__z1OperatorTestCase.test_inplace.<locals>.C.__imod__  rn  r   c                     dS )Nimulr1   r#   s     r   __imul__z1OperatorTestCase.test_inplace.<locals>.C.__imul__  rn  r   c                     dS )Nimatmulr1   r#   s     r   __imatmul__z4OperatorTestCase.test_inplace.<locals>.C.__imatmul__  rx  r   c                     dS )Niorr1   r#   s     r   __ior__z0OperatorTestCase.test_inplace.<locals>.C.__ior__  s    55r   c                     dS )Nipowr1   r#   s     r   __ipow__z1OperatorTestCase.test_inplace.<locals>.C.__ipow__  rn  r   c                     dS )Nirshiftr1   r#   s     r   __irshift__z4OperatorTestCase.test_inplace.<locals>.C.__irshift__  rx  r   c                     dS )Nisubr1   r#   s     r   __isub__z1OperatorTestCase.test_inplace.<locals>.C.__isub__  rn  r   c                     dS )Nitruedivr1   r#   s     r   __itruediv__z5OperatorTestCase.test_inplace.<locals>.C.__itruediv__  s    ::r   c                     dS )Nixorr1   r#   s     r   __ixor__z1OperatorTestCase.test_inplace.<locals>.C.__ixor__  rn  r   c                     dS )Nr   r1   r#   s     r   r    z4OperatorTestCase.test_inplace.<locals>.C.__getitem__  s    r   N)r.   r/   r0   rm  rq  rt  rw  r{  r~  r  r  r  r  r  r  r  r    r1   r   r   rj   rj    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   rj   r   rl  rp  rs  rv  rz  r}  r  r  r  r  r  r  r  )rD   rl   r   rl  rp  rs  rv  rz  r}  r  r  r  r  r  r  r  iconcat)r   r   rj   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         }d}|                     t          |          5  |                    dd           d d d            d S # 1 swxY w Y   d S )Nz"'int' object can't be concatenatedrS   g      ?)rD   assertRaisesRegexrY   r  )r   r   msgs      r   test_iconcat_without_getitemz-OperatorTestCase.test_iconcat_without_getitem  s    ;2##Is33 	% 	%Q$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%s   A		AAc                 .   | j         } G d d          }|                     |                     |                      d           |                     |                    d          d           |                     |                    d          d           |                     |                    d          d           |                     t          t
          f          5  |                    d           d d d            n# 1 swxY w Y   |                     t          t
          f          5  |                    t          dd                     d d d            n# 1 swxY w Y   |                     t          t
          f          5  |                    t          d                     d d d            n# 1 swxY w Y   |                     t          t
          f          5  |                    d            d d d            d S # 1 swxY w Y   d S )	Nc                       e Zd Zd ZdS )&OperatorTestCase.test_index.<locals>.Xc                     dS r   r1   r   s    r   	__index__z0OperatorTestCase.test_index.<locals>.X.__index__  s    qr   N)r.   r/   r0   r  r1   r   r   r  r  
  s#            r   r  rS   r   rV   g      ?r   r   )rD   r   indexrX   r  rY   r   r   )r   r   r  s      r   
test_indexzOperatorTestCase.test_index  s   ;	 	 	 	 	 	 	 	 	,,a000**A...**A...**A...	:;; 	  	 NN3	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 	:;; 	+ 	+NN8Aq>>***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+	:;; 	' 	'NN71::&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'	:;; 	! 	!NN4   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!sH   "DDD0$E  E$'E$#F;;F?F?'H

HHc                    | j         } G d d          }|                     t          |j                   |                     t          |j         |                       |                     |                    d                     |                     |                    dg                     |                     |                    d                     |                     |                    g                      d S )Nc                       e Zd Zd ZdS )%OperatorTestCase.test_not_.<locals>.Cc                     t           r   rf   r   s    r   r   z.OperatorTestCase.test_not_.<locals>.C.__bool__  ri   r   Nr   r1   r   r   rj   r    rk   r   rj   r   r   )rD   rX   rY   not_rg   r[   r\   rn   s      r   	test_not_zOperatorTestCase.test_not_  s    ;	" 	" 	" 	" 	" 	" 	" 	" 	)X]333+x}aacc:::q))***s++,,,a(()))b))*****r   c                 R   | 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            n# 1 swxY w Y    G d d          }d}| 
                    t          |          5  |                     |d          d	           d d d            n# 1 swxY w Y   |                     |                     |            d          d           d S )Nc                       e Zd Zd Zd ZdS ),OperatorTestCase.test_length_hint.<locals>.Xc                     || _         d S r   )rO   )r   rO   s     r   r   z5OperatorTestCase.test_length_hint.<locals>.X.__init__*  s    "


r   c                 T    t          | j                  t           u r| j        | j        S r   )typerO   r   s    r   __length_hint__z<OperatorTestCase.test_length_hint.<locals>.X.__length_hint__-  s'    
##t++*$:%r   N)r.   r/   r0   r   r  r1   r   r   r  r  )  s2        # # #& & & & &r   r  rV   r   )rS   rV   r   r   r   r   r>  c                       e Zd ZdS ),OperatorTestCase.test_length_hint.<locals>.YNr  r1   r   r   r  r  @  s          r   r  z0'str' object cannot be interpreted as an integerr   )rD   rl   r   length_hintr   NotImplementedrY   rX   r   LookupErrorr  )r   r   r  r  r  s        r   test_length_hintz!OperatorTestCase.test_length_hint'  su   ;	& 	& 	& 	& 	& 	& 	& 	& 	--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 	@##Is33 	. 	.  1u---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.--aacc266;;;;;sH   9E$$E(+E(	F44F8;F8$H		HH> I**I.1I.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   r1   )rT  kwargss     r   funcz(OperatorTestCase.test_call.<locals>.funcJ  s    $,#6r   r1   r   rS   )r   rS   rV   r   )r   obj)rD   r   call)r   r   r  s      r   	test_callzOperatorTestCase.test_callG  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 )_)rH   ).0rN   s     r   
<listcomp>z<OperatorTestCase.test_dunder_is_original.<locals>.<listcomp>V  s)    LLL$ts7K7KLLLLr   rC   r  )rD   dirrI   stripassertIs)r   r   namesrN   origdunders         r   test_dunder_is_originalz(OperatorTestCase.test_dunder_is_originalS  s    ;LL#h--LLL 	, 	,D8T**DXtdjjoo'='DdKKF ,fd+++		, 	,r   N)/r.   r/   r0   rP   r^   ra   ro   rv   ry   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  r!  rM  rg  r  r  r  r  r  r  r  r1   r   r   rA   rA   1   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% % %! ! !&
+ 
+ 
+< < <@
7 
7 
7, , , , ,r   rA   c                       e Zd ZeZdS )PyOperatorTestCaseN)r.   r/   r0   py_operatorrD   r1   r   r   r  r  ]  s        FFFr   r  zrequires _operatorc                       e Zd ZeZdS )COperatorTestCaseN)r.   r/   r0   
c_operatorrD   r1   r   r   r  r  `  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modulesrD   pickledumpsmodule2loads)r   r  protopickleds       r   copyzOperatorPickleTestCase.copyf  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  r1   r   r   r  r  n  r	  r   r  r  r  r  VrS   r  r  r  r  zt.u.v)rD   r  r  r  r  rL  ur   r   r  HIGHEST_PROTOCOLsubTestr  r   repr)r   r  r  r   r  r  f2s          r   r!  z&OperatorPickleTestCase.test_attrgetterl  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#  rS   r  rV   r   r   )	rD   rA  r   r  r  r  r  r   r  )r   rA  r   r  r  r  s         r   rM  z&OperatorPickleTestCase.test_itemgetter  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 rR  r1   rS  s      r   r  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.foo  rV  r   r   c                     |S r   r1   rX  s     r   rY  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.bar  rZ  r   c                  "    |d         |d         fS r\  r1   r]  s     r   r^  z7OperatorPickleTestCase.test_methodcaller.<locals>.A.baz  r_  r   Nr`  ra  r1   r   r   r  r    rb  r   r  rS   r  rY  r  rV   r   rd  r^  re  rc  r  )	rD   rf  r   r  r  r  r  r   r  )r   rf  r  r   r  r  r  s          r   rg  z(OperatorPickleTestCase.test_methodcaller  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/   r0   r  r!  rM  rg  r1   r   r   r  r  e  sP        ) ) ). . .8. . .. . . . .r   r  c                       e Zd ZeZeZdS )PyPyOperatorPickleTestCaseN)r.   r/   r0   r  rD   r  r1   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )PyCOperatorPickleTestCaseN)r.   r/   r0   r  rD   r  r  r1   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )CPyOperatorPickleTestCaseN)r.   r/   r0   r  rD   r  r  r1   r   r   r  r    s        FGGGr   r  c                       e Zd ZeZeZdS )CCOperatorPickleTestCaseN)r.   r/   r0   r  rD   r  r1   r   r   r  r    s        FGGGr   r  __main__)unittestr  r  decimalr   	fractionsr   testr   test.supportr   import_fresh_moduler  r  r   rl   r4   r<   rA   TestCaser  
skipUnlessr  r  r  r  r  r  r.   mainr1   r   r   <module>r     sF     



                   & & & & & & 0m/
9DG G G.].z6A]D D D
                        6                     
j, j, j, j, j, j, j, j,X    )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   