
    Kh                     F   S r SSKrSSKJr  SSKJr  SSKJrJ	r	J
r
   " S S5      r " S S5      r\R                  R                  S	\R                  " / S
QSS9\" / S
Q5      45       " S S5      5       r " S S5      r " S S5      r " S S5      rS rS rS rS rS rg)zE
Tests related to the ``symbol`` attribute of the ABCPolyBase class.
    N)array)assert_equalassert_raisesassert_c                       \ rS rSrSr/ SQrS r\R                  R                  SS\
4S\
4S\4S	\445      S
 5       r\R                  R                  SS5      S 5       rS rS rSrg)TestInit   z-
Test polynomial creation with symbol kwarg.
         c                 p    [         R                  " U R                  5      n[        UR                  S5        g )Nxpoly
Polynomialcr   symbolselfps     T/var/www/html/env/lib/python3.13/site-packages/numpy/polynomial/tests/test_symbol.pytest_default_symbolTestInit.test_default_symbol   s"    OODFF#QXXs#    )	bad_input	exception 3Nr   c                     [         R                  " U5         [        R                  " U R                  US9nS S S 5        g ! , (       d  f       g = f)Nr   )pytestraisesr   r   r   )r   r   r   r   s       r   test_symbol_bad_inputTestInit.test_symbol_bad_input   s0     ]]9%y9A &%%s    A  
Ar   )r   x_1Axyzu   βc                 n    [         R                  " U R                  US9n[        UR                  U5        g)z6
Values for symbol that should pass input validation.
r!   Nr   )r   r   r   s      r   test_valid_symbolsTestInit.test_valid_symbols   s&     OODFF62QXXv&r   c                     [         R                  " U R                  SS9n[        R                  " [
        5         SUl        SSS5        g! , (       d  f       g= f)z"
'symbol' attribute is read only.
r   r!   zN)r   r   r   r"   r#   AttributeErrorr   r   s     r   test_propertyTestInit.test_property-   s7     OODFF3/]]>*AH +**s   A
Ac                     [         R                  " U R                  SS9n[         R                  " UR                  SS9n[	        UR
                  S5        g )Nyr!   t)r   r   r   coefr   r   )r   r   pts      r   test_change_symbolTestInit.test_change_symbol5   s8    OODFF3/__QVVC0RYY$r    )__name__
__module____qualname____firstlineno____doc__r   r   r"   markparametrize
ValueError	TypeErrorr$   r*   r/   r6   __static_attributes__r8   r   r   r   r      s     	A$ [[7	Z	j	y	
I	: :: [[X ( ''%r   r   c                   R    \ rS rSr\R
                  " / SQSS9rS rS rS r	S r
S	rg
)TestUnaryOperators<   r
   r-   r!   c                 J    U R                   * n[        UR                  S5        g Nr-   r   r   r   )r   ns     r   test_negTestUnaryOperators.test_neg?   s    VVGQXXs#r   c                 N    U R                   S-  n[        UR                  S5        g N
   r-   rH   r   outs     r   test_scalarmul!TestUnaryOperators.test_scalarmulC   s    ffrkSZZ%r   c                 N    SU R                   -  n[        UR                  S5        g rM   rH   rO   s     r   test_rscalarmul"TestUnaryOperators.test_rscalarmulG   s    466kSZZ%r   c                 N    U R                   S-  n[        UR                  S5        g )Nr   r-   rH   rO   s     r   test_powTestUnaryOperators.test_powK   s    ffkSZZ%r   r8   N)r9   r:   r;   r<   r   r   r   rJ   rQ   rT   rW   rB   r8   r   r   rD   rD   <   s&    	#.A$&&&r   rD   rhs         r-   r!   c                   n    \ rS rSrSr\R                  " / SQSS9rS rS r	S r
S	 rS
 rS rS rS rSrg)TestBinaryOperatorsSameSymbolP   zW
Ensure symbol is preserved for numeric operations on polynomials with
the same symbol
r
   r-   r!   c                 N    U R                   U-   n[        UR                  S5        g rG   rH   r   rY   rP   s      r   test_add&TestBinaryOperatorsSameSymbol.test_add^       ffslSZZ%r   c                 N    U R                   U-
  n[        UR                  S5        g rG   rH   rb   s      r   test_sub&TestBinaryOperatorsSameSymbol.test_subb   re   r   c                 N    U R                   U-  n[        UR                  S5        g rG   rH   rb   s      r   test_polymul*TestBinaryOperatorsSameSymbol.test_polymulf   re   r   c                 j    [        U R                  U5       H  n[        UR                  S5        M     g rG   divmodr   r   r   rb   s      r   test_divmod)TestBinaryOperatorsSameSymbol.test_divmodj   s%    $&&#&CS) 'r   c                 L    XR                   -   n[        UR                  S5        g rG   rH   rb   s      r   	test_radd'TestBinaryOperatorsSameSymbol.test_raddn       FFlSZZ%r   c                 L    XR                   -
  n[        UR                  S5        g rG   rH   rb   s      r   	test_rsub'TestBinaryOperatorsSameSymbol.test_rsubr   rt   r   c                 L    XR                   -  n[        UR                  S5        g rG   rH   rb   s      r   	test_rmul'TestBinaryOperatorsSameSymbol.test_rmulv   rt   r   c                 h    [        XR                  5       H  n[        UR                  S5        M     g rG   rm   rb   s      r   test_rdivmod*TestBinaryOperatorsSameSymbol.test_rdivmodz   s#    #vv&CS) 'r   r8   N)r9   r:   r;   r<   r=   r   r   r   rc   rg   rj   ro   rr   rv   ry   r|   rB   r8   r   r   r_   r_   P   sA     		#.A&&&*&&&*r   r_   c                      \ rS rSr\R
                  " / SQSS9r\R
                  " / SQSS9r\R                  \R                  \R                  \R                  \R                  4r\R                  R!                  S\5      S 5       rS	rg
)"TestBinaryOperatorsDifferentSymbol   r
   r   r!   rZ   r2   fc                 8    [        [        XR                  5        g )N)r   r@   other)r   r   s     r   test_binops_fails4TestBinaryOperatorsDifferentSymbol.test_binops_fails   s    j!ZZ0r   r8   N)r9   r:   r;   r<   r   r   r   r   __add____sub____mul____floordiv____mod__opsr"   r>   r?   r   rB   r8   r   r   r   r      si    	#.AOOIc2E99aiiANNAII
FC[[S#&1 '1r   r   c                   F    \ rS rSr\R
                  " / SQSS9rS rS rSr	g)	TestEquality   r
   r   r!   c                 b    [         R                  " / SQSS9n[        U R                  U:H  5        g )Nr
   r   r!   r   r   r   r   r   r   s     r   test_eqTestEquality.test_eq   s"    	#6% r   c                 d    [         R                  " / SQSS9n[        U R                  U:X  + 5        g )Nr
   r2   r!   r   r   s     r   test_neqTestEquality.test_neq   s#    	#6DFFe#$r   r8   N)
r9   r:   r;   r<   r   r   r   r   r   rB   r8   r   r   r   r      s    	#.A!%r   r   c                       \ rS rSrSr\R                  " / SQSS9rS rS r	S r
\R                  R                  S	S
SS/0SSS/0S\R                  045      S 5       rS rS rSrg)TestExtraMethods   zB
Test other methods for manipulating/creating polynomial objects.
)r   r   r   r   r-   r!   c                 d    U R                   R                  5       n[        UR                  S5        g rG   )r   copyr   r   r   s     r   	test_copyTestExtraMethods.test_copy       U\\3'r   c                 d    U R                   R                  5       n[        UR                  S5        g rG   )r   trimr   r   r   s     r   	test_trimTestExtraMethods.test_trim   r   r   c                 f    U R                   R                  S5      n[        UR                  S5        g )Nr   r-   )r   truncater   r   r   s     r   test_truncateTestExtraMethods.test_truncate   s"    "U\\3'r   kwargdomainirN   windowkindc                 h    U R                   R                  " S0 UD6n[        UR                  S5        g )Nr-   r8   )r   convertr   r   )r   r   r   s      r   test_convertTestExtraMethods.test_convert   s'     ''U\\3'r   c                 d    U R                   R                  5       n[        UR                  S5        g rG   )r   integr   r   r   s     r   
test_integTestExtraMethods.test_integ       U\\3'r   c                 d    U R                   R                  5       n[        UR                  S5        g rG   )r   derivr   r   r   s     r   
test_derivTestExtraMethods.test_deriv   r   r   r8   N)r9   r:   r;   r<   r=   r   r   r   r   r   r   r"   r>   r?   	Chebyshevr   r   r   rB   r8   r   r   r   r      s     	S1A((( [[W	C9	C9	 ' 
(
(((r   r   c                      [         R                  " / SQSS9n [         R                  " / SQSS9nU " U5      nUR                  S:X  d   eg )N)r   r   r   r3   r!   )r\   r   r   u   λ_1)r   r   r   )r   qrs      r   test_compositionr      s=    	#.Af5A	!A88vr   c                      [        S5      4S-  u  p[        R                  R                  XSSS9n[	        UR
                  S5        g )NrN   r   r   r-   )degr   )ranger   r   fitr   r   )r   r2   r   s      r   test_fitr      s<    "I<>DAAa4A3r   c                  t    SS/n [         R                  R                  U SS9n[        UR                  S5        g )Nr   r-   r!   )r   r   	fromrootsr   r   )rootsr   s     r   test_froomrootsr      s2    GE!!%!4A3r   c                  v    [         R                  R                  SS/SS/SS9n [        U R                  S5        g )Nr   r   r\      r-   )r   r   r   )r   r   identityr   r   r   s    r   test_identityr      s3      QB LA3r   c                  l    [         R                  R                  SSS9n [        U R                  S5        g )Nr   r-   r!   )r   r   basisr   r   r   s    r   
test_basisr      s)    a,A3r   )r=   r"   numpy.polynomial
polynomialr   numpy._corer   numpy.testingr   r   r   r   rD   r>   r?   r   r_   r   r   r   r   r   r   r   r   r8   r   r   <module>r      s       > >.% .%b& &( 		#.i%* %*%*P1 1	% 	%!( !(H   
 r   