
    /hh@                         S r SSKrSSKrSSKrSSKrSSKJrJrJrJ	r	J
r
  S r " S S\R                  5      r " S S\R                  5      r\S	:X  a  \R                   " 5         gg)
zUnit tests for numbers.py.    N)ComplexRealRationalIntegralNumberc                     S n[        U 5       H.  n [        X5      nUR                  (       a  [        XU5        M.  M0     [
        R                  " U 5        U $ ! [         a     MW  f = f)Nc                      [        5       eN)NotImplementedError)argskwargss     C/opt/python-3.13.8/usr/lib/python3.13/test/test_abstract_numbers.pynot_implemented#concretize.<locals>.not_implemented   s    !##    )dirgetattr__isabstractmethod__setattrAttributeErrorabcupdate_abstractmethods)clsr   namevalues       r   
concretizer   
   sg    $ C	C&E))?3 *  s#J  		s   (A
A'&A'c                   &    \ rS rSrS rS rS rSrg)TestNumbers   c                 .   U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  [        [        [
        5      5        U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  S[        S5      R                  5        U R                  S[        S5      R                  5        U R                  S[        S5      R                  5       5        U R                  S[        S5      R                  5       5        U R                  S[        S5      R                  5        U R                  S[        S5      R                  5        g )N   r   i   )
assertTrue
issubclassintr   r   r   r   r   assertEqualrealimag	conjugate	numeratordenominatorselfs    r   test_intTestNumbers.test_int   s    
312
312
3-.
301
3/0CFKK(CFKK(CF,,./SW..01CF,,-CF../r   c                    U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  S[        S5      R                  5        U R                  S[        S5      R                  5        U R                  S[        S5      R                  5       5        U R                  S[        S5      R                  5       5        g )Ng333333@r   g333333)assertFalser$   floatr   r   r#   r   r   r   r&   r'   r(   r)   r,   s    r   
test_floatTestNumbers.test_float(   s    E845E845
5$/0
5'23
5&12eCjoo.E#JOO,eCj2245uT{4467r   c                    U R                  [        [        [        5      5        U R                  [        [        [        5      5        U R                  [        [        [
        5      5        U R                  [        [        [        5      5        U R                  [        [        [        5      5        [        SS5      [        SS5      p!U R                  [        [        R                  U5        U R                  [        [        R                  X5        U R                  [        [        X5        U R                  [        [        R                   X5        U R                  [        ["        U5        U R                  [        [$        U5        g )N         r"   )r1   r$   complexr   r   r   r#   r   r   assertRaises	TypeErrormathtruncoperatormoddivmodfloordivr2   r%   )r-   c1c2s      r   test_complexTestNumbers.test_complex4   s    GX67GX67GT23
7G45
7F34A!B)TZZ4)X\\2:)VR4)X%6%6?)UB/)S"-r    N)__name__
__module____qualname____firstlineno__r.   r3   rD   __static_attributes__rF   r   r   r   r      s    0
8.r   r   c                   ,    \ rS rSrS rS rS rS rSrg)TestNumbersDefaultMethodsE   c                   ^ [          " U4S jS[        5      5       mU R                  [        T" SS5      5      5        U R                  [        T" SS5      5      5        U R                  [        T" SS5      5      5        U R	                  [        T" SS5      5      5        U R                  T" SS5      [        SS5      -
  T" SS5      5        U R                  [        SS5      T" SS5      -
  T" SS5      5        g )Nc                   Z   > \ rS rSrS r\S 5       r\S 5       rU 4S jrU 4S jr	S r
Srg	)
9TestNumbersDefaultMethods.test_complex.<locals>.MyComplexG   c                     Xl         X l        g r
   )ri)r-   r'   r(   s      r   __init__BTestNumbersDefaultMethods.test_complex.<locals>.MyComplex.__init__I   s    r   c                     U R                   $ r
   )rT   r,   s    r   r'   >TestNumbersDefaultMethods.test_complex.<locals>.MyComplex.realM       vvr   c                     U R                   $ r
   )rU   r,   s    r   r(   >TestNumbersDefaultMethods.test_complex.<locals>.MyComplex.imagQ   rZ   r   c                    > [        U[        5      (       a7  T" U R                  UR                  -   U R                  UR                  -   5      $ [        er
   )
isinstancer   r(   r'   r   )r-   other	MyComplexs     r   __add__ATestNumbersDefaultMethods.test_complex.<locals>.MyComplex.__add__U   sB    eW--$TYY%;%)YY%;= =))r   c                 B   > T" U R                   * U R                  * 5      $ r
   )r'   r(   r-   r`   s    r   __neg__ATestNumbersDefaultMethods.test_complex.<locals>.MyComplex.__neg__[   s     $))diiZ88r   c                 (   [        U[        5      (       a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ [        U[        5      (       a/  U R                  S:H  =(       a    U R                  UR                  :H  $ g )Nr   )r^   r   r(   r'   r   r-   r_   s     r   __eq__@TestNumbersDefaultMethods.test_complex.<locals>.MyComplex.__eq__^   sf    eW--99

2NtyyEJJ7NNeV,,99>Edii5::.EE -r   )rU   rT   N)rG   rH   rI   rJ   rV   propertyr'   r(   ra   re   ri   rK   )r`   s   r   r`   rQ   G   s@        *9Fr   r`   r"   r   r7   r6   )r   r   r#   boolr1   r&   r9   rd   s    @r   rD   &TestNumbersDefaultMethods.test_complexF   s    		F 	F 
	F: 	Yq!_-.Yq!_-.Yq!_-.i1o./ 	1a71a=8)Aq/J 	A1a8)Aq/Jr   c                    [          " S S[        5      5       nU R                  [        U" S5      S5      S5        U R                  [        SU" S5      5      S5        U R                  [	        U" S5      5      S5        U R                  U" S5      R
                  S5        U R                  U" S5      R                  S5        U R                  U" S	5      R                  5       S	5        g )
Nc                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)3TestNumbersDefaultMethods.test_real.<locals>.MyRealq   c                     Xl         g r
   nr-   rt   s     r   rV   <TestNumbersDefaultMethods.test_real.<locals>.MyReal.__init__s       r   c                     U R                   $ r
   rs   r,   s    r   __pos__;TestNumbersDefaultMethods.test_real.<locals>.MyReal.__pos__v       vvr   c                 ,    [        U R                  5      $ r
   )r2   rt   r,   s    r   	__float__=TestNumbersDefaultMethods.test_real.<locals>.MyReal.__float__y   s    TVV}$r   c                      U R                   U-  $ r
   rs   rh   s     r   __floordiv__@TestNumbersDefaultMethods.test_real.<locals>.MyReal.__floordiv__|   s    vv&r   c                     XR                   -  $ r
   rs   rh   s     r   __rfloordiv__ATestNumbersDefaultMethods.test_real.<locals>.MyReal.__rfloordiv__   s    &r   c                      U R                   U-  $ r
   rs   rh   s     r   __mod__;TestNumbersDefaultMethods.test_real.<locals>.MyReal.__mod__   s    vv~%r   c                     XR                   -  $ r
   rs   rh   s     r   __rmod__<TestNumbersDefaultMethods.test_real.<locals>.MyReal.__rmod__   s    vv~%r   rs   N)rG   rH   rI   rJ   rV   ry   r}   r   r   r   r   rK   rF   r   r   MyRealrp   q   s%    %''&&r   r   r6   r7   )r"   r"   r"   y      ?        r   {   )r   r   r&   r@   r9   r'   r(   r)   )r-   r   s     r   	test_real#TestNumbersDefaultMethods.test_realp   s    		&T 	& 
	&. 	q	1-v6 	6!9-v6 	+T2 	+ 	+ 	..0#6r   c                 x    [          " S S[        5      5       nU R                  [        U" SS5      5      S5        g )Nc                   :    \ rS rSrS r\S 5       r\S 5       rSrg);TestNumbersDefaultMethods.test_rational.<locals>.MyRational   c                     Xl         X l        g r
   )rt   d)r-   r*   r+   s      r   rV   DTestNumbersDefaultMethods.test_rational.<locals>.MyRational.__init__   s    "$r   c                     U R                   $ r
   rs   r,   s    r   r*   ETestNumbersDefaultMethods.test_rational.<locals>.MyRational.numerator   rZ   r   c                     U R                   $ r
   )r   r,   s    r   r+   GTestNumbersDefaultMethods.test_rational.<locals>.MyRational.denominator   rZ   r   )r   rt   N)	rG   rH   rI   rJ   rV   rk   r*   r+   rK   rF   r   r   
MyRationalr      s/    %    r   r      r7   g      @)r   r   r&   r2   )r-   r   s     r   test_rational'TestNumbersDefaultMethods.test_rational   s9    		 	 
	 	z!Q/0#6r   c                 V   [          " S S[        5      5       nU R                  [        R                  " U" S5      5      S5        U R                  [        U" S5      5      S5        U R                  U" S5      R                  S5        U R                  U" S5      R                  S5        g )Nc                   &    \ rS rSrS rS rS rSrg);TestNumbersDefaultMethods.test_integral.<locals>.MyIntegral   c                     Xl         g r
   rs   ru   s     r   rV   DTestNumbersDefaultMethods.test_integral.<locals>.MyIntegral.__init__   rw   r   c                     U R                   $ r
   rs   r,   s    r   ry   CTestNumbersDefaultMethods.test_integral.<locals>.MyIntegral.__pos__   r{   r   c                     U R                   $ r
   rs   r,   s    r   __int__CTestNumbersDefaultMethods.test_integral.<locals>.MyIntegral.__int__   r{   r   rs   N)rG   rH   rI   rJ   rV   ry   r   rK   rF   r   r   
MyIntegralr      s    r   r   r   g     ^@r"   )r   r   r&   r>   indexr2   r*   r+   )r-   r   s     r   test_integral'TestNumbersDefaultMethods.test_integral   s    		 	 
	 	
38#> 	z#/7 	C22C8 	C44a8r   rF   N)	rG   rH   rI   rJ   rD   r   r   r   rK   rF   r   r   rM   rM   E   s    (KT(7V7&9r   rM   __main__)__doc__r   r<   r>   unittestnumbersr   r   r   r   r   r   TestCaser   rM   rG   mainrF   r   r   <module>r      s_      
    = =).(## ).X9 1 1 9D zMMO r   