U
    O8cO                  
   @   s  d dl mZmZ d dlZd dlmZmZmZ d dlm	Z
 d dlmZmZ d dlmZ d dlmZ G dd dZG d	d
 d
ZG dd dZdd Zdd Zejdeeddeddgeddfeddeddgeddfeededdgeddffdd Zejdeddd gedd!feddddggedd"ffd#d$ ZG d%d& d&Zejd'e
jd(fe
jd)fe
jd*fe
j d+fe
j!d,fe
j"d-ffd.d/ Z#G d0d1 d1Z$G d2d3 d3Z%d4Z&G d5d6 d6Z'dS )7    )naninfN)arrayarangeprintoptions)assert_equalassert_)Fraction)Decimalc                   @   s~  e Zd Zejddddd Zejdddd	gd
fddd	dgdfeddffdd Z	ejdddd	gdfddd	dgdfeddffdd Z
ejdddd	gdfddd	dgdfeddffdd Zejdddd	gdfddd	dgdfeddffdd  Zejdddd	gd!fddd	dgd"fedd#ffd$d% Zejdddd	gd&fddd	dgd'fedd(ffd)d* Zd+S ),TestStrUnicodeSuperSubscriptsclassTZscopeZautousec                 C   s   t d d S Nunicodepolyset_default_printstyleself r   H/tmp/pip-unpacked-wheel-fd_gsd75/numpy/polynomial/tests/test_printing.pyuse_unicode   s    z)TestStrUnicodeSuperSubscripts.use_unicodeinptgt            1.0 + 2.0·x + 3.0·x²r   u#   -1.0 + 0.0·x + 3.0·x² - 1.0·x³   u   0.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¹¹c                 C   s   t t|}t|| d S Nstrr   
Polynomialr   r   r   r   resr   r   r   test_polynomial_str   s    z1TestStrUnicodeSuperSubscripts.test_polynomial_str!   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)u   0.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)c                 C   s   t t|}t|| d S r!   r#   r   	Chebyshevr   r%   r   r   r   test_chebyshev_str   s    z0TestStrUnicodeSuperSubscripts.test_chebyshev_stru!   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)u   0.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)c                 C   s   t t|}t|| d S r!   r#   r   Legendrer   r%   r   r   r   test_legendre_str(   s    z/TestStrUnicodeSuperSubscripts.test_legendre_stru!   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)u   0.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)c                 C   s   t t|}t|| d S r!   r#   r   Hermiter   r%   r   r   r   test_hermite_str3   s    z.TestStrUnicodeSuperSubscripts.test_hermite_stru#   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)u   0.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)c                 C   s   t t|}t|| d S r!   r#   r   HermiteEr   r%   r   r   r   test_hermiteE_str>   s    	z/TestStrUnicodeSuperSubscripts.test_hermiteE_stru!   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)u   0.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)c                 C   s   t t|}t|| d S r!   r#   r   Laguerrer   r%   r   r   r   test_laguerre_strJ   s    z/TestStrUnicodeSuperSubscripts.test_laguerre_strN)__name__
__module____qualname__pytestfixturer   markparametrizer   r'   r+   r.   r1   r4   r7   r   r   r   r   r      sL   











r   c                   @   s~  e Zd Zejddddd Zejdddd	gd
fddd	dgdfeddffdd Z	ejdddd	gdfddd	dgdfeddffdd Z
ejdddd	gdfddd	dgdfeddffdd Zejdddd	gdfddd	dgdfeddffdd  Zejdddd	gd!fddd	dgd"fedd#ffd$d% Zejdddd	gd&fddd	dgd'fedd(ffd)d* Zd+S ),TestStrAsciir   Tr   c                 C   s   t d d S Nasciir   r   r   r   r   	use_asciiX   s    zTestStrAscii.use_asciir   r   r   r   1.0 + 2.0 x + 3.0 x**2r   r   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**11c                 C   s   t t|}t|| d S r!   r"   r%   r   r   r   r'   \   s    z TestStrAscii.test_polynomial_str1.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)c                 C   s   t t|}t|| d S r!   r)   r%   r   r   r   r+   g   s    	zTestStrAscii.test_chebyshev_strz1.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)c                 C   s   t t|}t|| d S r!   r,   r%   r   r   r   r.   s   s    	zTestStrAscii.test_legendre_strz1.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)c                 C   s   t t|}t|| d S r!   r/   r%   r   r   r   r1      s    	zTestStrAscii.test_hermite_strz1.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)c                 C   s   t t|}t|| d S r!   r2   r%   r   r   r   r4      s    	zTestStrAscii.test_hermiteE_strz1.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)c                 C   s   t t|}t|| d S r!   r5   r%   r   r   r   r7      s    	zTestStrAscii.test_laguerre_strN)r8   r9   r:   r;   r<   rB   r=   r>   r   r'   r+   r.   r1   r4   r7   r   r   r   r   r?   V   sL   











r?   c                   @   sX   e Zd Zejddddd Zdd Zdd	 Zd
d Zdd Z	ej
dddd ZdS )TestLinebreakingr   Tr   c                 C   s   t d d S r@   r   r   r   r   r   rB      s    zTestLinebreaking.use_asciic                 C   s8   t dddddg}ttt|d tt|d d S )NNa {   J   zJ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 123.0 x**4r   r$   r   lenr#   r   pr   r   r   test_single_line_one_less   s
    z*TestLinebreaking.test_single_line_one_lessc                 C   s8   t dddddg}ttt|d tt|d d S )NrF   i  K   zK12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 +
1234.0 x**4rI   rK   r   r   r   test_num_chars_is_linewidth   s
    z,TestLinebreaking.test_num_chars_is_linewidthc                 C   sD   t ddddddg}ttt|dd d tt|d d S )NrF   r   
r   rH   zZ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 1.0 x**4 +
12345678.0 x**5)r   r$   r   rJ   r#   splitrK   r   r   r   6test_first_linebreak_multiline_one_less_than_linewidth   s    zGTestLinebreaking.test_first_linebreak_multiline_one_less_than_linewidthc                 C   s(   t ddddddg}tt|d d S )NrF   g=
)gAr   z[12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.12 x**3 +
1.0 x**4 + 12345678.0 x**5)r   r$   r   r#   rK   r   r   r   +test_first_linebreak_multiline_on_linewidth   s    z<TestLinebreaking.test_first_linebreak_multiline_on_linewidth)lwr   ))rN   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 + 40000.0 x**4 + 500000.0 x**5 +
600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 + 900.0 x**9)-   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 +
40000.0 x**4 + 500000.0 x**5 +
600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 +
900.0 x**9)   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 + 40000.0 x**4 + 500000.0 x**5 + 600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 + 900.0 x**9c                 C   sj   t ddddddddd	d
g
}t|d8 tt|| t|dD ]}tt||k  qFW 5 Q R X d S )Nr   
      i  i@  i  i'	 ip i@  i  )Z	linewidthrP   )r   r$   r   r   r#   rQ   r   rJ   )r   rT   r   rL   liner   r   r   test_linewidth_printoption   s    z+TestLinebreaking.test_linewidth_printoptionN)r8   r9   r:   r;   r<   rB   rM   rO   rR   rS   r=   r>   rZ   r   r   r   r   rE      s   
		
rE   c               	   C   s   t dddg} t dddg}t d tt| d tt|d t d tt| d tt|d	 tt t d
 W 5 Q R X d S )Nr   r   r   rA   rC   rD   r   r   r(   Zinvalid_input)	r   r$   r*   r   r   r#   r;   raises
ValueError)rL   cr   r   r   test_set_default_printoptions   s    

r^   c                  C   sx   ddddg} t | }t t| td}t d tt|d tt|d t d	 tt|d
 tt|d dS )z%Test both numpy and built-in complex.y              ?y      ?      ?y              @y      @        Zdtyper   u*   1j + (1+1j)·x - (2-2j)·x² + (3+0j)·x³u+   1j + (1+1j)·x + (-2+2j)·x² + (3+0j)·x³rA   z)1j + (1+1j) x - (2-2j) x**2 + (3+0j) x**3z*1j + (1+1j) x + (-2+2j) x**2 + (3+0j) x**3N)r   r$   r   objectr   r   r#   )coefsp1p2r   r   r   test_complex_coefficients   s    


rd   )ra   r   r   r   r      r_   u   1/2 + 3/4·x      u   1 + 2·x + 5/7·x²z1.00z2.2u   1.00 + 2.2·x + 3·x²c                 C   s&   t | }t d tt|| d S r   r   r$   r   r   r#   ra   r   rL   r   r   r    test_numeric_object_coefficients  s    

rj   fu   1 + 2·x + f·x²u   1 + 2·x + [3, 4]·x²c                 C   s&   t | }t d tt|| dS )zK
    Test coef fallback for object arrays of non-numeric coefficients.
    r   Nrh   ri   r   r   r   #test_nonnumeric_object_coefficients  s    

rl   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )

TestFormatc                 C   s0   t d t ddddg}tt|dd d S )NrA   r   r   r   r   r   u"   1.0 + 2.0·x + 0.0·x² - 1.0·x³r   r   r$   r   formatrK   r   r   r   test_format_unicode!  s    
zTestFormat.test_format_unicodec                 C   s0   t d t ddddg}tt|dd d S )Nr   r   r   r   r   rA   z!1.0 + 2.0 x + 0.0 x**2 - 1.0 x**3rn   rK   r   r   r   test_format_ascii&  s    
 zTestFormat.test_format_asciic                 C   s8   t d t dddg}tt|d t| d d S )NrA   r   r   r   rC   rn   rK   r   r   r   test_empty_formatstr-  s    
zTestFormat.test_empty_formatstrc              	   C   s6   t ddddg}tt t|d W 5 Q R X d S )Nr   r   r   r   z.2f)r   r$   r;   r[   r\   ro   rK   r   r   r   test_bad_formatstr3  s    zTestFormat.test_bad_formatstrN)r8   r9   r:   rp   rq   rr   rs   r   r   r   r   rm      s   rm   )r   r   u   1.0 + 2.0·z + 3.0·z²u!   1.0 + 2.0·T₁(z) + 3.0·T₂(z)u!   1.0 + 2.0·H₁(z) + 3.0·H₂(z)u#   1.0 + 2.0·He₁(z) + 3.0·He₂(z)u!   1.0 + 2.0·L₁(z) + 3.0·L₂(z)u!   1.0 + 2.0·P₁(z) + 3.0·P₂(z)c                 C   s$   | dddgdd}t |d| d S )Nr   r   r   zsymbolr   )r   )r   r   rL   r   r   r   test_symbol9  s    	rw   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestReprc                 C   s$   t tddg}d}t|| d S )Nr   r   zBPolynomial([0., 1.], domain=[-1,  1], window=[-1,  1], symbol='x'))reprr   r$   r   r   r&   r   r   r   r   r'   G  s    zTestRepr.test_polynomial_strc                 C   s$   t tddg}d}t|| d S )Nr   r   zAChebyshev([0., 1.], domain=[-1,  1], window=[-1,  1], symbol='x'))ry   r   r*   r   rz   r   r   r   r+   O  s    zTestRepr.test_chebyshev_strc                 C   s$   t tddg}d}t|| d S )Nr   r   z@Legendre([0., 1.], domain=[-1,  1], window=[-1,  1], symbol='x'))ry   r   r-   r   rz   r   r   r   test_legendre_reprW  s    zTestRepr.test_legendre_reprc                 C   s$   t tddg}d}t|| d S )Nr   r   z?Hermite([0., 1.], domain=[-1,  1], window=[-1,  1], symbol='x'))ry   r   r0   r   rz   r   r   r   test_hermite_repr_  s    zTestRepr.test_hermite_reprc                 C   s$   t tddg}d}t|| d S )Nr   r   z@HermiteE([0., 1.], domain=[-1,  1], window=[-1,  1], symbol='x'))ry   r   r3   r   rz   r   r   r   test_hermiteE_reprg  s    zTestRepr.test_hermiteE_reprc                 C   s$   t tddg}d}t|| d S )Nr   r   z<Laguerre([0., 1.], domain=[0, 1], window=[0, 1], symbol='x'))ry   r   r6   r   rz   r   r   r   test_laguerre_repro  s    zTestRepr.test_laguerre_reprN)	r8   r9   r:   r'   r+   r{   r|   r}   r~   r   r   r   r   rx   F  s   rx   c                   @   s8   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d ZdS )TestLatexReprz#Test the latex repr used by Jupyterc                 C   s$   ddd|_ z| W S |` X d S )NFc                 S   s   t | S r!   )r#   )xparensr   r   r   <lambda>      z(TestLatexRepr.as_latex.<locals>.<lambda>)F)Z_repr_latex_scalar_repr_latex_)r   objr   r   r   as_latex{  s    zTestLatexRepr.as_latexc                 C   s   t dddg}t| |d t jdddgddgd}t| |d t jdddgd	d
gd}t| |d t jdddgddgd}t| |d d S )Nr   r   r   z%$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$r   domainzK$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}$r   r$   r   r   rK   r   r   r   test_simple_polynomial  s     



z$TestLatexRepr.test_simple_polynomialc                 C   sL   t dddg}t| |d t jdddgddgd}t| |d d S )	Nr   r   r   z?$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$r   r   r   zZ$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)$)r   r*   r   r   rK   r   r   r   test_basis_func  s    

zTestLatexRepr.test_basis_funcc                 C   s$   t dddg}t| |d d S )Nr   r   r   zB$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$)r   r3   r   r   rK   r   r   r   test_multichar_basis_func  s    
z'TestLatexRepr.test_multichar_basis_funcc                 C   s   t jdddgdd}t| |d t jdddgddgdd	}t| |d
 t jdddgddgdd	}t| |d t jdddgddgdd	}t| |d d S )Nr   r   r   rt   ru   z%$z \mapsto 1.0 + 2.0\,z + 3.0\,z^{2}$r   r   )r   rv   zK$z \mapsto 1.0 + 2.0\,\left(1.0 + z\right) + 3.0\,\left(1.0 + z\right)^{2}$r   r   zE$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}$r   rK   r   r   r   test_symbol_basic  s&    
		zTestLatexRepr.test_symbol_basicN)	r8   r9   r:   __doc__r   r   r   r   r   r   r   r   r   r   x  s   
	r   )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**5c                   @   s8   e Zd ZdZdd Zdd Zdd Zdd	 Zd
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.
    c              	   C   sH   t ddddg}tt|d tdd tt|d W 5 Q R X d S )	Nr   $I$I?I$Ir?kAm۶mAzC0.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**3r   r$   r   r#   r   rK   r   r   r   test_str  s    zTestPrintOptions.test_strc              	   C   sH   t ddddg}t| d tdd t| d W 5 Q R X d S )	Nr   r   r   r   zp$x \mapsto \text{0.5} + \text{0.14285714}\,x + \text{14285714.28571429}\,x^{2} + \text{(1.42857143e+08)}\,x^{3}$r   r   za$x \mapsto \text{0.5} + \text{0.143}\,x + \text{14285714.286}\,x^{2} + \text{(1.429e+08)}\,x^{3}$)r   r$   r   r   r   rK   r   r   r   
test_latex  s    zTestPrintOptions.test_latexc              	   C   sh   t dg}tt|d tdd tt|d W 5 Q R X tddd tt|d W 5 Q R X d S )	Nr   z0.5Zfixed)	floatmodez
0.50000000re   )r   r   z0.5000r   rK   r   r   r   
test_fixed  s    zTestPrintOptions.test_fixedc              
   C   sd   t tD ]V\}}t|d> tdd t|d d D }t|dd|ksTtW 5 Q R X qd S )Nr   c                 S   s   g | ]}d d|   qS )gރB?rW   r   ).0ir   r   r   
<listcomp>  s   z7TestPrintOptions.test_switch_to_exp.<locals>.<listcomp>r   r   rP    )		enumerateSWITCH_TO_EXPr   r   r$   ranger#   replaceAssertionError)r   r   srL   r   r   r   test_switch_to_exp   s    
z#TestPrintOptions.test_switch_to_expc              	   C   sj   t ttg}t|dkst| dks.ttddd& t|dksLt| dks\tW 5 Q R X d S )Nznan + inf xz&$x \mapsto \text{nan} + \text{inf}\,x$ZNANZINF)ZnanstrZinfstrzNAN + INF xz&$x \mapsto \text{NAN} + \text{INF}\,x$)r   r$   r   r   r#   r   r   r   rK   r   r   r   test_non_finite  s    z TestPrintOptions.test_non_finiteN)	r8   r9   r:   r   r   r   r   r   r   r   r   r   r   r     s   	
r   )(mathr   r   r;   Z
numpy.corer   r   r   Znumpy.polynomialZ
polynomialr   Znumpy.testingr   r   Z	fractionsr	   decimalr
   r   r?   rE   r^   rd   r=   r>   r`   rj   rl   rm   r$   r*   r0   r3   r6   r-   rw   rx   r   r   r   r   r   r   r   <module>   sT   JNB

	
2U