K iLdZddlZddlmZddlmZddlmZm Z m Z GddZ GddZ ejjd ejgd d egd fGd dZGddZGddZGddZdZdZdZdZdZy)zE Tests related to the ``symbol`` attribute of the ABCPolyBase class. N)array)assert_ assert_equal assert_raisesceZdZdZgdZdZejjdde fde fde fde ffd Z ejjd d d Z d Z dZy)TestInitz5 Test polynomial creation with symbol kwarg. cntj|j}t|jdy)Nxpoly Polynomialcrsymbolselfps h/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/polynomial/tests/test_symbol.pytest_default_symbolzTestInit.test_default_symbols" OODFF #QXXs#) bad_input exception3Nr ctj|5tj|j|}dddy#1swYyxYw)Nr)pytestraisesrrr)rrrrs rtest_symbol_bad_inputzTestInit.test_symbol_bad_inputs9]]9 % :y9A : : :s "AA r)rx_1Axyzuβcrtj|j|}t|j|y)zF Values for symbol that should pass input validation. rNr)rrrs rtest_valid_symbolszTestInit.test_valid_symbols s& OODFF6 2QXXv&rctj|jd}tjt 5d|_dddy#1swYyxYw)z2 'symbol' attribute is read only. rrzN)rrrr r!AttributeErrorrrs r test_propertyzTestInit.test_property.s@ OODFF3 / ]]> * AH   s A  Actj|jd}tj|jd}t |j dy)Nyrt)rrrcoefrr)rrpts rtest_change_symbolzTestInit.test_change_symbol6s8 OODFF3 / __QVVC 0RYY$r)__name__ __module__ __qualname____doc__rrr mark parametrize ValueError TypeErrorr"r'r+r1rrrr s A$ [[7 Z j y I : :  : [[X(''%rrcPeZdZejgddZdZdZdZdZ y) TestUnaryOperatorsr r)rcJ|j }t|jdyNr)rrr)rns rtest_negzTestUnaryOperators.test_neg@s VVGQXXs#rcN|jdz}t|jdyN r)r?routs rtest_scalarmulz!TestUnaryOperators.test_scalarmulDsffrkSZZ%rcNd|jz}t|jdyrCr?rEs rtest_rscalarmulz"TestUnaryOperators.test_rscalarmulHs466kSZZ%rcN|jdz}t|jdy)Nr r)r?rEs rtest_powzTestUnaryOperators.test_powLsffkSZZ%rN) r2r3r4rrrrArGrIrKr:rrr<r<=s( #.A$&&&rr<rhsr)rcleZdZdZej gddZdZdZdZ dZ d Z d Z d Z d Zy )TestBinaryOperatorsSameSymbolzc Ensure symbol is preserved for numeric operations on polynomials with the same symbol r r)rcN|j|z}t|jdyr>r?rrLrFs rtest_addz&TestBinaryOperatorsSameSymbol.test_add_ffslSZZ%rcN|j|z }t|jdyr>r?rTs rtest_subz&TestBinaryOperatorsSameSymbol.test_subcrVrcN|j|z}t|jdyr>r?rTs r test_polymulz*TestBinaryOperatorsSameSymbol.test_polymulgrVrcft|j|D]}t|jdyr>divmodrrrrTs r test_divmodz)TestBinaryOperatorsSameSymbol.test_divmodks*$&&#& *C S ) *rcN||jz}t|jdyr>r?rTs r test_raddz'TestBinaryOperatorsSameSymbol.test_raddoDFFlSZZ%rcN||jz }t|jdyr>r?rTs r test_rsubz'TestBinaryOperatorsSameSymbol.test_rsubsrarcN||jz}t|jdyr>r?rTs r test_rmulz'TestBinaryOperatorsSameSymbol.test_rmulwrarcft||jD]}t|jdyr>r\rTs r test_rdivmodz*TestBinaryOperatorsSameSymbol.test_rdivmod{s*#tvv& *C S ) *rN)r2r3r4r5rrrrUrXrZr^r`rcrergr:rrrRrRQsC  #.A&&&*&&&*rrRceZdZejgddZejgddZejejejejejfZ e jjde dZy) "TestBinaryOperatorsDifferentSymbolr rrrMr-fc:tt||jy)N)rr8other)rrjs rtest_binops_failsz4TestBinaryOperatorsDifferentSymbol.test_binops_failssj!TZZ0rN)r2r3r4rrrrl__add____sub____mul__ __floordiv____mod__opsr r6r7rmr:rrrirism #.A DOOIc 2E 99aiiANNAII FC [[S#&1'1rricDeZdZejgddZdZdZy) TestEqualityr rrcftjgdd}t|j|k(y)Nr rrrrrrrrls rtest_eqzTestEquality.test_eqs" #6% rchtjgdd}t|j|k( y)Nr r-rrwrxs rtest_neqzTestEquality.test_neqs% #6DFFeO#$rN)r2r3r4rrrryr{r:rrrurus #.A!%rruceZdZdZej gddZdZdZdZ e jjdd d d gid d d gid ejifdZdZdZy)TestExtraMethodszJ Test other methods for manipulating/creating polynomial objects. )r r r rr)rcd|jj}t|jdyr>)rcopyrrrxs r test_copyzTestExtraMethods.test_copy U\\3'rcd|jj}t|jdyr>)rtrimrrrxs r test_trimzTestExtraMethods.test_trimrrcf|jjd}t|jdy)Nr r))rtruncaterrrxs r test_truncatezTestExtraMethods.test_truncates""U\\3'rkwargdomainirDwindowkindch|jjdi|}t|jdy)Nr)r:)rconvertrr)rrrls r test_convertzTestExtraMethods.test_converts) ''U\\3'rcd|jj}t|jdyr>)rintegrrrxs r test_integzTestExtraMethods.test_integ U\\3'rcd|jj}t|jdyr>)rderivrrrxs r test_derivzTestExtraMethods.test_derivrrN)r2r3r4r5rrrrrrr r6r7 Chebyshevrrrr:rrr}r}s  S1A((( [[W C9 C9  ' (  (((rr}ctjgdd}tjgdd}||}|jdk(sJy)N)r r r r.r)rOr ruλ_1)rrr)rqrs rtest_compositionrs=  #.A  f5A !A 88v  rctdfdz\}}tjj||dd}t |j dy)NrDr r r))degr)rangerrfitrr)rr-rs rtest_fitrsA "Irs>>.%.%b&&(  #. i%*%*%*P11 % %!(!(H    r