bg-P nddlmZmZddlZddlmZmZmZddlm Z ddl m Z m Z ddlmZddlmZGddZGd d ZGd d Zd ZdZejdeeddeddgedfeddeddgedfeededdgedffdZejdegdedfeddddggedffd ZGd!d"Zejd#e jd$fe jd%fe jd&fe j d'fe j!d(fe j"d)ffd*Z#Gd+d,Z$Gd-d.Z%d/Z&Gd0d1Z'dS)2)naninfN)arrayarange printoptions) assert_equalassert_)Fraction)DecimalceZdZejdddZejdgddfgdd fed d ffd Z ejdgdd fgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffd Zd!S)"TestStrUnicodeSuperSubscriptsclassTscopeautousec.tjddSNunicodepolyset_default_printstyleselfs w/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/polynomial/tests/test_printing.py use_unicodez)TestStrUnicodeSuperSubscripts.use_unicodes #I.....inptgt1.0 + 2.0·x + 3.0·x²rr#r&u#-1.0 + 0.0·x + 3.0·x² - 1.0·x³ u0.0 + 1.0·x + 2.0·x² + 3.0·x³ + 4.0·x⁴ + 5.0·x⁵ + 6.0·x⁶ + 7.0·x⁷ + 8.0·x⁸ + 9.0·x⁹ + 10.0·x¹⁰ + 11.0·x¹¹chttj|}t||dSNstrr Polynomialrrrrress rtest_polynomial_strz1TestStrUnicodeSuperSubscripts.test_polynomial_str1$/#&&''S#r!1.0 + 2.0·T₁(x) + 3.0·T₂(x)u1-1.0 + 0.0·T₁(x) + 3.0·T₂(x) - 1.0·T₃(x)u0.0 + 1.0·T₁(x) + 2.0·T₂(x) + 3.0·T₃(x) + 4.0·T₄(x) + 5.0·T₅(x) + 6.0·T₆(x) + 7.0·T₇(x) + 8.0·T₈(x) + 9.0·T₉(x) + 10.0·T₁₀(x) + 11.0·T₁₁(x)chttj|}t||dSr)r+r Chebyshevrr-s rtest_chebyshev_strz0TestStrUnicodeSuperSubscripts.test_chebyshev_strs1$.%%&&S#ru!1.0 + 2.0·P₁(x) + 3.0·P₂(x)u1-1.0 + 0.0·P₁(x) + 3.0·P₂(x) - 1.0·P₃(x)u0.0 + 1.0·P₁(x) + 2.0·P₂(x) + 3.0·P₃(x) + 4.0·P₄(x) + 5.0·P₅(x) + 6.0·P₆(x) + 7.0·P₇(x) + 8.0·P₈(x) + 9.0·P₉(x) + 10.0·P₁₀(x) + 11.0·P₁₁(x)chttj|}t||dSr)r+rLegendrerr-s rtest_legendre_strz/TestStrUnicodeSuperSubscripts.test_legendre_str(1$-$$%%S#ru!1.0 + 2.0·H₁(x) + 3.0·H₂(x)u1-1.0 + 0.0·H₁(x) + 3.0·H₂(x) - 1.0·H₃(x)u0.0 + 1.0·H₁(x) + 2.0·H₂(x) + 3.0·H₃(x) + 4.0·H₄(x) + 5.0·H₅(x) + 6.0·H₆(x) + 7.0·H₇(x) + 8.0·H₈(x) + 9.0·H₉(x) + 10.0·H₁₀(x) + 11.0·H₁₁(x)chttj|}t||dSr)r+rHermiterr-s rtest_hermite_strz.TestStrUnicodeSuperSubscripts.test_hermite_str3s1$,s##$$S#ru#1.0 + 2.0·He₁(x) + 3.0·He₂(x)u4-1.0 + 0.0·He₁(x) + 3.0·He₂(x) - 1.0·He₃(x)u0.0 + 1.0·He₁(x) + 2.0·He₂(x) + 3.0·He₃(x) + 4.0·He₄(x) + 5.0·He₅(x) + 6.0·He₆(x) + 7.0·He₇(x) + 8.0·He₈(x) + 9.0·He₉(x) + 10.0·He₁₀(x) + 11.0·He₁₁(x)chttj|}t||dSr)r+rHermiteErr-s rtest_hermiteE_strz/TestStrUnicodeSuperSubscripts.test_hermiteE_str>1$-$$%%S#ru!1.0 + 2.0·L₁(x) + 3.0·L₂(x)u1-1.0 + 0.0·L₁(x) + 3.0·L₂(x) - 1.0·L₃(x)u0.0 + 1.0·L₁(x) + 2.0·L₂(x) + 3.0·L₃(x) + 4.0·L₄(x) + 5.0·L₅(x) + 6.0·L₆(x) + 7.0·L₇(x) + 8.0·L₈(x) + 9.0·L₉(x) + 10.0·L₁₀(x) + 11.0·L₁₁(x)chttj|}t||dSr)r+rLaguerrerr-s rtest_laguerre_strz/TestStrUnicodeSuperSubscripts.test_laguerre_strJr:rN)__name__ __module__ __qualname__pytestfixturermark parametrizerr/r5r9r>rBrGrrr r sV^'4000//10/ [^ -. >? $ &. [^ 78 LM K M. [^ 78 LM K M. [^ 78 LM K M. [^ 9: OP * ,. [^ 78 LM K M.rr ceZdZejdddZejdgddfgdd fed d ffd Z ejdgdd fgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffdZ ejdgddfgddfed dffd Zd!S)" TestStrAsciirTrc.tjddSNasciirrs r use_asciizTestStrAscii.use_asciiX #G,,,,,rrr 1.0 + 2.0 x + 3.0 x**2r%z"-1.0 + 0.0 x + 3.0 x**2 - 1.0 x**3r'z}0.0 + 1.0 x + 2.0 x**2 + 3.0 x**3 + 4.0 x**4 + 5.0 x**5 + 6.0 x**6 + 7.0 x**7 + 8.0 x**8 + 9.0 x**9 + 10.0 x**10 + 11.0 x**11chttj|}t||dSr)r*r-s rr/z TestStrAscii.test_polynomial_str\r0r1.0 + 2.0 T_1(x) + 3.0 T_2(x)z+-1.0 + 0.0 T_1(x) + 3.0 T_2(x) - 1.0 T_3(x)z0.0 + 1.0 T_1(x) + 2.0 T_2(x) + 3.0 T_3(x) + 4.0 T_4(x) + 5.0 T_5(x) + 6.0 T_6(x) + 7.0 T_7(x) + 8.0 T_8(x) + 9.0 T_9(x) + 10.0 T_10(x) + 11.0 T_11(x)chttj|}t||dSr)r3r-s rr5zTestStrAscii.test_chebyshev_strgs1$.%%&&S#rz1.0 + 2.0 P_1(x) + 3.0 P_2(x)z+-1.0 + 0.0 P_1(x) + 3.0 P_2(x) - 1.0 P_3(x)z0.0 + 1.0 P_1(x) + 2.0 P_2(x) + 3.0 P_3(x) + 4.0 P_4(x) + 5.0 P_5(x) + 6.0 P_6(x) + 7.0 P_7(x) + 8.0 P_8(x) + 9.0 P_9(x) + 10.0 P_10(x) + 11.0 P_11(x)chttj|}t||dSr)r7r-s rr9zTestStrAscii.test_legendre_strsrCrz1.0 + 2.0 H_1(x) + 3.0 H_2(x)z+-1.0 + 0.0 H_1(x) + 3.0 H_2(x) - 1.0 H_3(x)z0.0 + 1.0 H_1(x) + 2.0 H_2(x) + 3.0 H_3(x) + 4.0 H_4(x) + 5.0 H_5(x) + 6.0 H_6(x) + 7.0 H_7(x) + 8.0 H_8(x) + 9.0 H_9(x) + 10.0 H_10(x) + 11.0 H_11(x)chttj|}t||dSr)r<r-s rr>zTestStrAscii.test_hermite_strs1$,s##$$S#rz1.0 + 2.0 He_1(x) + 3.0 He_2(x)z.-1.0 + 0.0 He_1(x) + 3.0 He_2(x) - 1.0 He_3(x)z0.0 + 1.0 He_1(x) + 2.0 He_2(x) + 3.0 He_3(x) + 4.0 He_4(x) + 5.0 He_5(x) + 6.0 He_6(x) + 7.0 He_7(x) + 8.0 He_8(x) + 9.0 He_9(x) + 10.0 He_10(x) + 11.0 He_11(x)chttj|}t||dSr)r@r-s rrBzTestStrAscii.test_hermiteE_strrCrz1.0 + 2.0 L_1(x) + 3.0 L_2(x)z+-1.0 + 0.0 L_1(x) + 3.0 L_2(x) - 1.0 L_3(x)z0.0 + 1.0 L_1(x) + 2.0 L_2(x) + 3.0 L_3(x) + 4.0 L_4(x) + 5.0 L_5(x) + 6.0 L_6(x) + 7.0 L_7(x) + 8.0 L_8(x) + 9.0 L_9(x) + 10.0 L_10(x) + 11.0 L_11(x)chttj|}t||dSr)rEr-s rrGzTestStrAscii.test_laguerre_strrCrN)rHrIrJrKrLrUrMrNrr/r5r9r>rBrGrOrrrQrQVsV^'4000--10- [^ ,- => ; =. [^ 34 FG % '. [^ 34 FG % '. [^ 34 FG % '. [^ 56 IJ 6 8. [^ 34 FG % '.rrQceZdZejdddZdZdZdZdZ ej d d d Z d S) TestLinebreakingrTrc.tjddSrSrrs rrUzTestLinebreaking.use_asciirVrctjgd}ttt |dtt |ddS)N)Narcrcrc{JzJ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 123.0 x**4rr,rlenr+rps rtest_single_line_one_lessz*TestLinebreaking.test_single_line_one_lesss] OIII J JSQ[["%%%SVV +     rctjgd}ttt |dtt |ddS)N)rcrcrcrciKzK12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 1234.0 x**4rfrhs rtest_num_chars_is_linewidthz,TestLinebreaking.test_num_chars_is_linewidths] OJJJ K KSQ[["%%%SVV -     rctjgd}ttt |dddtt |ddS)N)rcrcrcrcr!rc rrezZ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 1.0 x**4 + 12345678.0 x**5)rr,rrgr+splitrhs r6test_first_linebreak_multiline_one_less_than_linewidthzGTestLinebreaking.test_first_linebreak_multiline_one_less_than_linewidthsv OEEE   SQd++A.//444SVV <     rcltjgd}tt|ddS)N)rcrcrcg= )gAr!rcz[12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.12 x**3 + 1.0 x**4 + 12345678.0 x**5)rr,rr+rhs r+test_first_linebreak_multiline_on_linewidthz1a&))**   S#rcpttjddg}d}t||dS)Nrr!z@Legendre([0., 1.], domain=[-1, 1], window=[-1, 1], symbol='x'))rrr8rrs rtest_legendre_reprzTestRepr.test_legendre_reprW?4=!Q(())   S#rcpttjddg}d}t||dS)Nrr!z?Hermite([0., 1.], domain=[-1, 1], window=[-1, 1], symbol='x'))rrr=rrs rtest_hermite_reprzTestRepr.test_hermite_repr_s?4<A''((   S#rcpttjddg}d}t||dS)Nrr!z@HermiteE([0., 1.], domain=[-1, 1], window=[-1, 1], symbol='x'))rrrArrs rtest_hermiteE_reprzTestRepr.test_hermiteE_reprgrrcpttjddg}d}t||dS)Nrr!zz(TestLatexRepr.as_latex..s Qr)F)_repr_latex_scalar _repr_latex_)robjs ras_latexzTestLatexRepr.as_latex{sB"@!?!? '##%%&&& & & & &s!%ctjgd}t||dtjgdddg}t||dtjgdddg}t||d tjgdd dg}t||d dS) Nr z%$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$rdomainzK$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$?zE$x \mapsto 1.0 + 2.0\,\left(2.0x\right) + 3.0\,\left(2.0x\right)^{2}$r&zQ$x \mapsto 1.0 + 2.0\,\left(1.0 + 2.0x\right) + 3.0\,\left(1.0 + 2.0x\right)^{2}$rr,rrrhs rtest_simple_polynomialz$TestLatexRepr.test_simple_polynomials OIII & &T]]1%% 4 6 6 6 OIIIr1g 6 6 6T]]1%% Z \ \ \ OIIItSk : : :T]]1%% T V V V OIIIr1g 6 6 6T]]1%% ` b b b b brctjgd}t||dtjgdddg}t||ddS)Nr z?$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$r&rrzZ$x \mapsto 1.0\,{T}_{0}(1.0 + 2.0x) + 2.0\,{T}_{1}(1.0 + 2.0x) + 3.0\,{T}_{2}(1.0 + 2.0x)$)rr4rrrhs rtest_basis_funczTestLatexRepr.test_basis_funcs N999 % %T]]1%% N P P P N999b!W 5 5 5T]]1%% i k k k k krcxtjgd}t||ddS)Nr zB$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$)rrArrrhs rtest_multichar_basis_funcz'TestLatexRepr.test_multichar_basis_funcsG M))) $ $T]]1%% Q S S S S Srctjgdd}t||dtjgdddgd}t||dtjgdd d gd}t||d tjgdd dgd}t||d dS)Nr rrz%$z \mapsto 1.0 + 2.0\,z + 3.0\,z^{2}$rr)rrzK$z \mapsto 1.0 + 2.0\,\left(1.0 + z\right) + 3.0\,\left(1.0 + z\right)^{2}$rrzE$z \mapsto 1.0 + 2.0\,\left(2.0z\right) + 3.0\,\left(2.0z\right)^{2}$r&zQ$z \mapsto 1.0 + 2.0\,\left(1.0 + 2.0z\right) + 3.0\,\left(1.0 + 2.0z\right)^{2}$rrhs rtest_symbol_basiczTestLatexRepr.test_symbol_basics OIIIc 2 2 2T]]1%% 4 6 6 6 OIIIr1gc B B B MM!  -    OIIItSk# F F F MM!  *    OIIIr1gc B B B MM!  0     rN) rHrIrJ__doc__rrrrrrOrrrrxsn--'''bbb*kkkSSS " " " " " rr)z"1.0 + (1.0e-01) x + (1.0e-02) x**2z"1.2 + (1.2e-01) x + (1.2e-02) x**2z11.23 + 0.12 x + (1.23e-02) x**2 + (1.23e-03) x**3z51.235 + 0.123 x + (1.235e-02) x**2 + (1.235e-03) x**3zG1.2346 + 0.1235 x + 0.0123 x**2 + (1.2346e-03) x**3 + (1.2346e-04) x**4zL1.23457 + 0.12346 x + 0.01235 x**2 + (1.23457e-03) x**3 + (1.23457e-04) x**4za1.234568 + 0.123457 x + 0.012346 x**2 + 0.001235 x**3 + (1.234568e-04) x**4 + (1.234568e-05) x**5zg1.2345679 + 0.1234568 x + 0.0123457 x**2 + 0.0012346 x**3 + (1.2345679e-04) x**4 + (1.2345679e-05) x**5cfeZdZdZejdddZdZdZdZ d Z d Z d S) TestPrintOptionsz Test the output is properly configured via printoptions. The exponential notation is enabled automatically when the values are too small or too large. rTrc.tjddSrSrrs rrUzTestPrintOptions.use_asciirVrctjgd}tt|dt d5tt|dddddS#1swxYwYdS)Nrg$I$I?gI$Ir?kAgm۶mAzC0.5 + 0.14285714 x + 14285714.28571429 x**2 + (1.42857143e+08) x**3r# precisionz40.5 + 0.143 x + 14285714.286 x**2 + (1.429e+08) x**3rr,rr+rrhs rtest_strzTestPrintOptions.test_strs O<<< = =SVV7 8 8 8A & & & 7 7 Q"6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7sA//A36A3c tjgd}t|dt d5t|dddddS#1swxYwYdS)Nrzp$x \mapsto \text{0.5} + \text{0.14285714}\,x + \text{14285714.28571429}\,x^{2} + \text{(1.42857143e+08)}\,x^{3}$r#rza$x \mapsto \text{0.5} + \text{0.143}\,x + \text{14285714.286}\,x^{2} + \text{(1.429e+08)}\,x^{3}$)rr,rrrrhs r test_latexzTestPrintOptions.test_latexs O<<< = =Q^^%% / 0 0 0 A & & & L L ))K L L L L L L L L L L L L L L L L L L L L Ls #A99A=A=ctjdg}tt|dt d5tt|ddddn #1swxYwYt dd5tt|dddddS#1swxYwYdS) Nrz0.5fixed) floatmodez 0.50000000r)rrz0.5000rrhs r test_fixedzTestPrintOptions.test_fixeds4 OSE " "SVVU### G , , , / / Q . . . / / / / / / / / / / / / / / /Gq 9 9 9 + + Q * * * + + + + + + + + + + + + + + + + + +s$A--A14A1 B44B8;B8c @ttD]\}}t|5tjdt |dzdzD}t |dd|ksJ dddn #1swxYwYdS)Nrc g|] }dd| zz S)gރB?rxrO).0is r z7TestPrintOptions.test_switch_to_exp..s3%=%=%=)*&0QB%6%=%=%=rr"r#ro ) enumerate SWITCH_TO_EXPrrr,ranger+replace)rrsris rtest_switch_to_expz#TestPrintOptions.test_switch_to_expsm,, 6 6DAq*** 6 6O%=%=.3AqDFmm%=%=%=>>1vv~~dC00A55555 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6sABB B cXtjttg}t |dksJ|dksJt dd5t |dksJ|dksJ ddddS#1swxYwYdS)Nz nan + inf xz&$x \mapsto \text{nan} + \text{inf}\,x$NANINF)nanstrinfstrz NAN + INF xz&$x \mapsto \text{NAN} + \text{INF}\,x$)rr,rrr+rrrhs rtest_non_finitez TestPrintOptions.test_non_finite s OS#J ' '1vv&&&&~~#LLLLL u 5 5 5 : :q66]****>>##9::::: : : : : : : : : : : : : : : : : : :s!0BB#&B#N) rHrIrJrrKrLrUrrrrrrOrrrrs V^'4000--10-777 L L L+++666:::::rr)(mathrrrK numpy.corerrrnumpy.polynomial polynomialr numpy.testingrr fractionsr decimalr r rQr`rrrMrNrrrrr,r4r=rArFr8rrrrrrOrrrs 2222222222////////GGGGGGGGTKKKKKKKK\?(?(?(?(?(?(?(?(D 5 5 5 H H H) UHHQNNHHQNN +6::: UAq((1a.. !000 UGGFOOWWU^^Q /v>>>  ,     ) U;;;f%%%':; UAq1a&>(((*BC, 2 _/0 ^89 \67 ]9: ]78 ]78 +&&& ////////dR R R R R R R R j 3 8:8:8:8:8:8:8:8:8:8:r