
    qKg                     L   d Z ddlZddlmZ ddlmZ ddlmZm	Z	m
Z
  G d d      Z G d d      Zej                  j                  d	 ej                  g d
d       eg d
      f       G d d             Z G d d      Z G d d      Z G d d      Zd Zd Zd Zd Zd Zy)zE
Tests related to the ``symbol`` attribute of the ABCPolyBase class.
    N)array)assert_equalassert_raisesassert_c                       e Zd ZdZg dZd Zej                  j                  dde	fde	fde
fde
ff      d	        Zej                  j                  d
d      d        Zd Zd Zy)TestInitz5
    Test polynomial creation with symbol kwarg.
             c                 n    t        j                  | j                        }t        |j                  d       y )Nxpoly
Polynomialcr   symbolselfps     f/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numpy/polynomial/tests/test_symbol.pytest_default_symbolzTestInit.test_default_symbol   s"    OODFF#QXXs#    )	bad_input	exception 3Nr
   c                     t        j                  |      5  t        j                  | j                  |      }d d d        y # 1 sw Y   y xY w)Nr   )pytestraisesr   r   r   )r   r   r   r   s       r   test_symbol_bad_inputzTestInit.test_symbol_bad_input   s0     ]]9%y9A &%%s   "AA
r   )r   x_1Axyzu   βc                 r    t        j                  | j                  |      }t        |j                  |       y)zF
        Values for symbol that should pass input validation.
        r   Nr   )r   r   r   s      r   test_valid_symbolszTestInit.test_valid_symbols   s&     OODFF62QXXv&r   c                     t        j                  | j                  d      }t        j                  t
              5  d|_        ddd       y# 1 sw Y   yxY w)z2
        'symbol' attribute is read only.
        r   r   zN)r   r   r   r    r!   AttributeErrorr   r   s     r   test_propertyzTestInit.test_property-   s7     OODFF3/]]>*AH +**s   AAc                     t        j                  | j                  d      }t        j                  |j                  d      }t	        |j
                  d       y )Nyr   t)r   r   r   coefr   r   )r   r   pts      r   test_change_symbolzTestInit.test_change_symbol5   s8    OODFF3/__QVVC0RYY$r   )__name__
__module____qualname____doc__r   r   r    markparametrize
ValueError	TypeErrorr"   r'   r+   r1    r   r   r   r      s     	A$ [[7	Z	j	y	
I	: :: [[X ( ''%r   r   c                   P    e Zd Z ej                  g dd      Zd Zd Zd Zd Z	y)	TestUnaryOperatorsr	   r)   r   c                 J    | j                    }t        |j                  d       y Nr)   r   r   r   )r   ns     r   test_negzTestUnaryOperators.test_neg?   s    VVGQXXs#r   c                 N    | j                   dz  }t        |j                  d       y N
   r)   r?   r   outs     r   test_scalarmulz!TestUnaryOperators.test_scalarmulC   s    ffrkSZZ%r   c                 N    d| j                   z  }t        |j                  d       y rC   r?   rE   s     r   test_rscalarmulz"TestUnaryOperators.test_rscalarmulG   s    466kSZZ%r   c                 N    | j                   dz  }t        |j                  d       y )Nr   r)   r?   rE   s     r   test_powzTestUnaryOperators.test_powK   s    ffkSZZ%r   N)
r2   r3   r4   r   r   r   rA   rG   rI   rK   r:   r   r   r<   r<   <   s(    	#.A$&&&r   r<   rhs         r)   r   c                   l    e Zd ZdZ ej
                  g dd      Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)TestBinaryOperatorsSameSymbolzc
    Ensure symbol is preserved for numeric operations on polynomials with
    the same symbol
    r	   r)   r   c                 N    | j                   |z   }t        |j                  d       y r>   r?   r   rL   rF   s      r   test_addz&TestBinaryOperatorsSameSymbol.test_add^       ffslSZZ%r   c                 N    | j                   |z
  }t        |j                  d       y r>   r?   rT   s      r   test_subz&TestBinaryOperatorsSameSymbol.test_subb   rV   r   c                 N    | j                   |z  }t        |j                  d       y r>   r?   rT   s      r   test_polymulz*TestBinaryOperatorsSameSymbol.test_polymulf   rV   r   c                 f    t        | j                  |      D ]  }t        |j                  d        y r>   divmodr   r   r   rT   s      r   test_divmodz)TestBinaryOperatorsSameSymbol.test_divmodj   s%    $&&#&CS) 'r   c                 N    || j                   z   }t        |j                  d       y r>   r?   rT   s      r   	test_raddz'TestBinaryOperatorsSameSymbol.test_raddn       DFFlSZZ%r   c                 N    || j                   z
  }t        |j                  d       y r>   r?   rT   s      r   	test_rsubz'TestBinaryOperatorsSameSymbol.test_rsubr   ra   r   c                 N    || j                   z  }t        |j                  d       y r>   r?   rT   s      r   	test_rmulz'TestBinaryOperatorsSameSymbol.test_rmulv   ra   r   c                 f    t        || j                        D ]  }t        |j                  d        y r>   r\   rT   s      r   test_rdivmodz*TestBinaryOperatorsSameSymbol.test_rdivmodz   s%    #tvv&CS) 'r   N)r2   r3   r4   r5   r   r   r   rU   rX   rZ   r^   r`   rc   re   rg   r:   r   r   rR   rR   P   sC     		#.A&&&*&&&*r   rR   c                      e Zd Z ej                  g dd      Z ej                  g dd      Zej                  ej                  ej                  ej                  ej                  fZej                  j                  de      d        Zy)	"TestBinaryOperatorsDifferentSymbolr	   r   r   rM   r-   fc                 :    t        t        || j                         y )N)r   r8   other)r   rj   s     r   test_binops_failsz4TestBinaryOperatorsDifferentSymbol.test_binops_fails   s    j!TZZ0r   N)r2   r3   r4   r   r   r   rl   __add____sub____mul____floordiv____mod__opsr    r6   r7   rm   r:   r   r   ri   ri      sm    	#.ADOOIc2E99aiiANNAII
FC[[S#&1 '1r   ri   c                   D    e Zd Z ej                  g dd      Zd Zd Zy)TestEqualityr	   r   r   c                 f    t        j                  g dd      }t        | j                  |k(         y )Nr	   r   r   r   r   r   r   r   rl   s     r   test_eqzTestEquality.test_eq   s"    	#6% r   c                 h    t        j                  g dd      }t        | j                  |k(          y )Nr	   r-   r   rw   rx   s     r   test_neqzTestEquality.test_neq   s%    	#6DFFeO#$r   N)r2   r3   r4   r   r   r   ry   r{   r:   r   r   ru   ru      s    	#.A!%r   ru   c                       e Zd ZdZ ej
                  g dd      Zd Zd Zd Z	e
j                  j                  dd	d
dgidd
dgidej                  if      d        Zd Zd Zy)TestExtraMethodszJ
    Test other methods for manipulating/creating polynomial objects.
    )r
   r   r   r   r)   r   c                 d    | j                   j                         }t        |j                  d       y r>   )r   copyr   r   rx   s     r   	test_copyzTestExtraMethods.test_copy       U\\3'r   c                 d    | j                   j                         }t        |j                  d       y r>   )r   trimr   r   rx   s     r   	test_trimzTestExtraMethods.test_trim   r   r   c                 f    | j                   j                  d      }t        |j                  d       y )Nr   r)   )r   truncater   r   rx   s     r   test_truncatezTestExtraMethods.test_truncate   s"    "U\\3'r   kwargdomainirD   windowkindc                 h     | j                   j                  di |}t        |j                  d       y )Nr)   r:   )r   convertr   r   )r   r   rl   s      r   test_convertzTestExtraMethods.test_convert   s)     ''U\\3'r   c                 d    | j                   j                         }t        |j                  d       y r>   )r   integr   r   rx   s     r   
test_integzTestExtraMethods.test_integ       U\\3'r   c                 d    | j                   j                         }t        |j                  d       y r>   )r   derivr   r   rx   s     r   
test_derivzTestExtraMethods.test_deriv   r   r   N)r2   r3   r4   r5   r   r   r   r   r   r   r    r6   r7   	Chebyshevr   r   r   r:   r   r   r}   r}      s     	S1A((( [[W	C9	C9	 ' 
(
(((r   r}   c                      t        j                  g dd      } t        j                  g dd      } | |      }|j                  dk(  sJ y )N)r   r   r
   r.   r   )rO   r
   r   u   λ_1)r   r   r   )r   qrs      r   test_compositionr      s=    	#.Af5A	!A88vr   c                      t        d      fdz  \  } }t        j                  j                  | |dd      }t	        |j
                  d       y )NrD   r   r
   r)   )degr   )ranger   r   fitr   r   )r   r-   r   s      r   test_fitr      s@    "I<>DAqAqa4A3r   c                  z    ddg} t         j                  j                  | d      }t        |j                  d       y )Nr   r)   r   )r   r   	fromrootsr   r   )rootsr   s     r   test_froomrootsr      s2    GE!!%!4A3r   c                  |    t         j                  j                  ddgddgd      } t        | j                  d       y )Nr   r
   rO      r)   )r   r   r   )r   r   identityr   r   r   s    r   test_identityr      s3      QB LA3r   c                  r    t         j                  j                  dd      } t        | j                  d       y )Nr   r)   r   )r   r   basisr   r   r   s    r   
test_basisr      s)    a,A3r   )r5   r    numpy.polynomial
polynomialr   numpy._corer   numpy.testingr   r   r   r   r<   r6   r7   r   rR   ri   ru   r}   r   r   r   r   r   r:   r   r   <module>r      s       > >.% .%b& &( 		#.i%* %*%*P1 1	% 	%!( !(H   
 r   