bgxdZddlZddlmZddlmZddlmZm Z m Z GddZ GddZ ej d ejgd d egd fGd dZGddZGddZGddZdZdZdZdZdZdS)zE Tests related to the ``symbol`` attribute of the ABCPolyBase class. N)array) assert_equal assert_raisesassert_ceZdZdZgdZdZejdde fde fde fde ffd Z ejd d d Z d Z dZdS)TestInitz5 Test polynomial creation with symbol kwarg. cbtj|j}t|jddS)Nxpoly Polynomialcrsymbolselfps u/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/polynomial/tests/test_symbol.pytest_default_symbolzTestInit.test_default_symbols+ ODF # #QXs#####) bad_input exception3Nr ctj|5tj|j|}ddddS#1swxYwYdS)Nr)pytestraisesrrr)rrrrs rtest_symbol_bad_inputzTestInit.test_symbol_bad_inputs]9 % % : :y999A : : : : : : : : : : : : : : : : : :s>AAr)rx_1Axyzuβcftj|j|}t|j|dS)zF Values for symbol that should pass input validation. rNr)rrrs rtest_valid_symbolszTestInit.test_valid_symbolss2 ODF6 2 2 2QXv&&&&&rctj|jd}tjt 5d|_ddddS#1swxYwYdS)z2 'symbol' attribute is read only. rrzN)rrrr r!AttributeErrorrrs r test_propertyzTestInit.test_property-s ODF3 / / / ]> * *  AH                  sA  AActj|jd}tj|jd}t |jddS)Nyrt)rrrcoefrr)rrpts rtest_change_symbolzTestInit.test_change_symbol5sF ODF3 / / / _QVC 0 0 0RY$$$$$r)__name__ __module__ __qualname____doc__rrr mark parametrize ValueError TypeErrorr"r'r+r1rrrr s  A$$$ [7 Z j y I : ::  : [X('''%%%%%rrcNeZdZejgddZdZdZdZdZ dS) TestUnaryOperatorsr r)rc@|j }t|jddSNr)rrr)rns rtest_negzTestUnaryOperators.test_neg?s# VGQXs#####rcD|jdz}t|jddSN r)r?routs rtest_scalarmulz!TestUnaryOperators.test_scalarmulCs%frkSZ%%%%%rcDd|jz}t|jddSrCr?rEs rtest_rscalarmulz"TestUnaryOperators.test_rscalarmulGs%46kSZ%%%%%rcD|jdz}t|jddS)Nr r)r?rEs rtest_powzTestUnaryOperators.test_powKs%fkSZ%%%%%rN) r2r3r4rrrrArGrIrKr:rrr<r<<sj #...A$$$&&&&&&&&&&&rr<rhsr)rcjeZdZdZejgddZdZdZdZ dZ d Z d Z d Z d Zd S)TestBinaryOperatorsSameSymbolzc Ensure symbol is preserved for numeric operations on polynomials with the same symbol r r)rcD|j|z}t|jddSr>r?rrLrFs rtest_addz&TestBinaryOperatorsSameSymbol.test_add^%fslSZ%%%%%rcD|j|z }t|jddSr>r?rTs rtest_subz&TestBinaryOperatorsSameSymbol.test_subbrVrcD|j|z}t|jddSr>r?rTs r test_polymulz*TestBinaryOperatorsSameSymbol.test_polymulfrVrc`t|j|D]}t|jddSr>divmodrrrrTs r test_divmodz)TestBinaryOperatorsSameSymbol.test_divmodjs<$&#&& * *C S ) ) ) ) * *rcD||jz}t|jddSr>r?rTs r test_raddz'TestBinaryOperatorsSameSymbol.test_raddn%DFlSZ%%%%%rcD||jz }t|jddSr>r?rTs r test_rsubz'TestBinaryOperatorsSameSymbol.test_rsubrrarcD||jz}t|jddSr>r?rTs r test_rmulz'TestBinaryOperatorsSameSymbol.test_rmulvrarc`t||jD]}t|jddSr>r\rTs r test_rdivmodz*TestBinaryOperatorsSameSymbol.test_rdivmodzs<#tv&& * *C S ) ) ) ) * *rN)r2r3r4r5rrrrUrXrZr^r`rcrergr:rrrRrRPs  #...A&&&&&&&&&***&&&&&&&&&*****rrRceZdZejgddZejgddZejejej ej ej fZ e jde dZdS) "TestBinaryOperatorsDifferentSymbolr rrrMr-fc<tt||jdS)N)rr8other)rrjs rtest_binops_failsz4TestBinaryOperatorsDifferentSymbol.test_binops_failssj!TZ00000rN)r2r3r4rrrrl__add____sub____mul__ __floordiv____mod__opsr r6r7rmr:rrriris #...A DOIIIc 2 2 2E 9aiANAI FC [S#&&11'&111rricBeZdZejgddZdZdZdS) TestEqualityr rrcftjgdd}t|j|kdS)Nr rrrrrrrrls rtest_eqzTestEquality.test_eqs4 #666%     rchtjgdd}t|j|k dS)Nr r-rrwrxs rtest_neqzTestEquality.test_neqs7 #666DFeO#$$$$$rN)r2r3r4rrrryr{r:rrrurusL #...A!!!%%%%%rruceZdZdZejgddZdZdZdZ e j dd d d gid d d gid ej ifdZdZdZdS)TestExtraMethodszJ Test other methods for manipulating/creating polynomial objects. )r r r rr)rcb|j}t|jddSr>)rcopyrrrxs r test_copyzTestExtraMethods.test_copy) U\3'''''rcb|j}t|jddSr>)rtrimrrrxs r test_trimzTestExtraMethods.test_trimrrcd|jd}t|jddS)Nr r))rtruncaterrrxs r test_truncatezTestExtraMethods.test_truncates-""U\3'''''rkwargdomainirDwindowkindcT|jjdi|}t|jddS)Nr)r:)rconvertrr)rrrls r test_convertzTestExtraMethods.test_converts5 ''''U\3'''''rcb|j}t|jddSr>)rintegrrrxs r test_integzTestExtraMethods.test_integ) U\3'''''rcb|j}t|jddSr>)rderivrrrxs r test_derivzTestExtraMethods.test_derivrrN)r2r3r4r5rrrrrrr r6r7 Chebyshevrrrr:rrr}r}s  S111A((((((((( [W C9 C9  ' ((  (((((((((rr}ctjgdd}tjgdd}||}|jdksJdS)N)r r r r.r)rOr ruλ_1)rrr)rqrs rtest_compositionrsX  #...A  f555A !A 8v      rctdfdz\}}tj||dd}t |jddS)NrDr r r))degr)rangerrfitrr)rr-rs rtest_fitrsM "II<>DAq Aqa44A3rczddg}tj|d}t|jddS)Nr r)r)rr fromrootsrr)rootsrs rtest_froomrootsrs= GE !!%!44A3rc|tjddgddgd}t|jddS)Nrr rOr))rrr)rridentityrrrs r test_identityrs>   QB LLA3rcrtjdd}t|jddS)Nr r)r)rrbasisrrrs r test_basisrs4 a,,A3r)r5r numpy.polynomial polynomialr numpy.corer numpy.testingrrrrr<r6r7rrRrirur}rrrrrr:rrrs >>>>>>>>>>.%.%.%.%.%.%.%.%b&&&&&&&&(  #... iii%*%*%*%*%*%*%*%*P11111111 % % % % % % % %!(!(!(!(!(!(!(!(H              r