o
    8Va 0                     @   s\  d Z ddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z)m*Z*m+Z+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2 d	d
 Z3dd Z4dd Z5dd Z6dd Z7dd Z8dd Z9dd Z:dd Z;dd Z<dd Z=dd  Z>d!d" Z?d#d$ Z@d%d& ZAd'd( ZBd)d* ZCd+d, ZDd-d. ZEd/d0 ZFd1d2 ZGd3d4 ZHd5d6 ZId7d8 ZJd9d: ZKd;d< ZLd=d> ZMd?d@ ZNdAdB ZOdCdD ZPdEdF ZQdGdH ZRdIdJ ZSdKdL ZTdMdN ZUdOdP ZVdQdR ZWdSdT ZXdUdV ZYdWdX ZZdYdZ Z[d[d\ Z\d]d^ Z]d_d` Z^dadb Z_dcdd Z`deS )fzFTests for options manager for :class:`Poly` and public API functions.     )OptionsExpandGensWrtSortOrderFieldGreedyDomainSplitGaussian	ExtensionModulus	SymmetricStrictAutoFracFormalPolysIncludeAllGenSymbolsMethod)lex)FFGFZZQQQQ_IRRCCEX)OptionErrorGeneratorsError)IntegerSymbolIsqrt)raisesxyzc                  C   s   t tttfddi} | jtttfksJ | jtksJ d| v du s#J | ttfdd}| jtttfks7J | jtks>J d| v du sFJ |jttfksOJ |jtksVJ d|v du s^J d S )Ndomainr   orderFr   )gensr/   T)r   r+   r,   r-   r0   r.   r   Zclone)optZnew_opt r2   D/usr/lib/python3/dist-packages/sympy/polys/tests/test_polyoptions.pytest_Options_clone   s   r4   c                   C   Z   t ddu s	J t ddu sJ t ddu sJ t ddu s$J ttdd  d S )NFTr      c                   S   
   t tS N)r   
preprocessr+   r2   r2   r2   r3   <lambda>+      
 z(test_Expand_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Expand_preprocess$   
   r<   c                  C   &   ddi} t |  | ddiksJ d S )NexpandT)r   postprocessr1   r2   r2   r3   test_Expand_postprocess.      
rB   c                      s   t ddks	J t tttftttfksJ t tttfftttfks(J tddd ttdd  tt fdd d S )	Nr8   r2   aF)Zcommutativec                   S   s   t tttfS r8   r   r9   r+   r,   r2   r2   r2   r3   r:   <       z&test_Gens_preprocess.<locals>.<lambda>c                      s   t tt fS r8   rE   r2   rD   r2   r3   r:   =   rF   )r   r9   r+   r,   r-   r&   r)   r$   r2   r2   rG   r3   test_Gens_preprocess5   s    rH   c                  C   s.   dt tfi} t|  | dt tfiksJ d S )Nr0   )r+   r,   r   r@   rA   r2   r2   r3   test_Gens_postprocess@   s   
rI   c                   C   s   t tdgks
J t dg ksJ t dg ksJ t dddgks'J t dddgks2J t dddgks=J t dddgksHJ t d	ddgksSJ t d
ddgks^J t ttgddgkskJ ttdd  ttdd  d S )Nr+     zx,yr,   zx yzx, yzx , yz x, yz x,  yc                   S   
   t dS )N,r   r9   r2   r2   r2   r3   r:   S   r;   z%test_Wrt_preprocess.<locals>.<lambda>c                   S   rL   Nr   rN   r2   r2   r2   r3   r:   T   r;   )r   r9   r+   r,   r)   r#   r2   r2   r2   r3   test_Wrt_preprocessG   s   rP   c                  C   s*   ddgi} t |  | ddgiksJ d S )NZwrtr+   )r   r@   rA   r2   r2   r3   test_Wrt_postprocessW   s   

rQ   c                   C   s   t tttgg dksJ t tttfg dksJ t dg dks'J t dg dks2J ttdd  ttdd  d S )Nr*   z	x > y > zzx>y>zc                   S   rL   rO   )r   r9   r2   r2   r2   r3   r:   e   r;   z&test_Sort_preprocess.<locals>.<lambda>c                   S   s   t ttthS r8   )r   r9   r+   r,   r-   r2   r2   r2   r3   r:   f   rF   )r   r9   r+   r,   r-   r)   r#   r2   r2   r2   r3   test_Sort_preprocess^   s   rR   c                  C   r>   )Nsortzx > y)r   r@   rA   r2   r2   r3   test_Sort_postprocessi   rC   rT   c                   C   s   t dtks	J d S )Nr   )r   r9   r   r2   r2   r2   r3   test_Order_preprocessp   s   rU   c                  C   r>   )Nr/   T)r   r@   rA   r2   r2   r3   test_Order_postprocesst   rC   rV   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:      r;   z'test_Field_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Field_preprocess{   r=   rW   c                  C   r>   )NZfieldT)r   r@   rA   r2   r2   r3   test_Field_postprocess   rC   rX   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r	   r9   r+   r2   r2   r2   r3   r:      r;   z(test_Greedy_preprocess.<locals>.<lambda>)r	   r9   r)   r#   r2   r2   r2   r3   test_Greedy_preprocess   r=   rY   c                  C   r>   )NZgreedyT)r	   r@   rA   r2   r2   r3   test_Greedy_postprocess   rC   rZ   c                   C   s  t ttks	J t ttksJ t ttksJ t tdtdks(J t tttf tttf ks9J t dtksBJ t dtksKJ t dtksTJ t dtks]J t dtksfJ t dtdksqJ t d	tdks|J t	t
d
d  t dtt ksJ t dtt ksJ t dtt ksJ t dtt ksJ t dtt ksJ t dtt ksJ t dtt ksJ t dtt ksJ t dtttf ksJ t dtttf ksJ t dtttf ksJ t dtttf ksJ t dtttf ksJ t dtttf ks-J t dtttf ks;J t dtttf ksIJ t	t
dd  t dttks]J t dttksjJ t dttkswJ t d ttksJ t d!tttksJ t d"tttksJ t d#tttksJ t d$tttksJ t d%ttksJ t d&ttksJ t d'ttdtksJ t d(ttdtksJ t	t
d)d  d S )*N   ZQr   r   r"   zFF(23)   zGF(23)c                   S   rL   )NzZ[]r
   r9   r2   r2   r2   r3   r:      r;   z(test_Domain_preprocess.<locals>.<lambda>zZ[x]zQ[x]zR[x]zC[x]zZZ[x]zQQ[x]zRR[x]zCC[x]zZ[x,y]zQ[x,y]zR[x,y]zC[x,y]zZZ[x,y]zQQ[x,y]zRR[x,y]zCC[x,y]c                   S   rL   )NzZ()r_   r2   r2   r2   r3   r:      r;   zZ(x)zQ(x)zZZ(x)zQQ(x)zZ(x,y)zQ(x,y)zZZ(x,y)zQQ(x,y)zQ<I>zQQ<I>zQ<sqrt(2), I>zQQ<sqrt(2), I>c                   S   rL   )Nabcr_   r2   r2   r2   r3   r:      r;   )r
   r9   r   r   r"   r   r+   r,   r   r)   r#   r    r!   Z
frac_fieldalgebraic_fieldr'   r(   r2   r2   r2   r3   test_Domain_preprocess   s^   " 
rb   c                   C   s.   t tdd  t tdd  t tdd  d S )Nc                   S   s   t ttftttf dS )Nr0   r.   )r
   r@   r+   r,   r   r-   r2   r2   r2   r3   r:      s   
 
z)test_Domain_postprocess.<locals>.<lambda>c                   S   s   t dtdS )Nr2   rc   r
   r@   r"   r2   r2   r2   r3   r:      s    c                   S   s   t dtiS )Nr.   rd   r2   r2   r2   r3   r:          )r)   r$   r2   r2   r2   r3   test_Domain_postprocess   s   rf   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:      r;   z'test_Split_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Split_preprocess   r=   rg   c                   C      t tdd  d S )Nc                   S   s   t ddiS )NsplitT)r   r@   r2   r2   r2   r3   r:      re   z(test_Split_postprocess.<locals>.<lambda>)r)   NotImplementedErrorr2   r2   r2   r3   test_Split_postprocess      rk   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:      r;   z*test_Gaussian_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Gaussian_preprocess   r=   rm   c                  C   s(   ddi} t |  | dtdksJ d S )NgaussianT)rn   r.   )r   r@   r   rA   r2   r2   r3   test_Gaussian_postprocess   s   
ro   c                   C   s   t ddu s	J t ddu sJ t g d u sJ t tdtdhks)J t tdgtdhks8J t tdtgtdthksIJ ttdd  ttdd  d S )NTr6   r[   c                   S   rL   )NFr   r9   r2   r2   r2   r3   r:     r;   z+test_Extension_preprocess.<locals>.<lambda>c                   S   rL   rO   rp   r2   r2   r2   r3   r:     r;   )r   r9   r(   r'   r)   r#   r2   r2   r2   r3   test_Extension_preprocess  s   "rq   c                  C   s`   dt dhi} t|  | t dhtt ddksJ ddi} t|  | ddiks.J d S )N	extensionr[   )rr   r.   T)r(   r   r@   r   ra   rA   r2   r2   r3   test_Extension_postprocess  s   

rs   c                   C   sH   t ddks	J t tddksJ ttdd  ttdd  d S )Nr^   c                   S   rL   rO   )r   r9   r2   r2   r2   r3   r:   *  r;   z)test_Modulus_preprocess.<locals>.<lambda>c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:   +  r;   )r   r9   r%   r)   r#   r2   r2   r2   r3   test_Modulus_preprocess&  s   rt   c                  C   sZ   ddi} t |  | dtddksJ ddd} t |  | dtddddks+J d S )Nmodulus   )ru   r.   F)ru   	symmetric)ru   r.   rw   )r   r@   r   rA   r2   r2   r3   test_Modulus_postprocess.  s   


rx   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:   H  r;   z+test_Symmetric_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Symmetric_preprocessA  r=   ry   c                  C   r>   )Nrw   T)r   r@   rA   r2   r2   r3   test_Symmetric_postprocessK  rC   rz   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:   Y  r;   z(test_Strict_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Strict_preprocessR  r=   r{   c                  C   r>   )NstrictT)r   r@   rA   r2   r2   r3   test_Strict_postprocess\  rC   r}   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:   j  r;   z&test_Auto_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Auto_preprocessc  r=   r~   c                  C   r>   )NautoT)r   r@   rA   r2   r2   r3   test_Auto_postprocessm  rC   r   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:   {  r;   z&test_Frac_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Frac_preprocesst  r=   r   c                  C   r>   )NZfracT)r   r@   rA   r2   r2   r3   test_Frac_postprocess~  rC   r   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:     r;   z(test_Formal_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Formal_preprocess  r=   r   c                  C   r>   )NZformalT)r   r@   rA   r2   r2   r3   test_Formal_postprocess  rC   r   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:     r;   z'test_Polys_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Polys_preprocess  r=   r   c                  C   r>   )NZpolysT)r   r@   rA   r2   r2   r3   test_Polys_postprocess  rC   r   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:     r;   z)test_Include_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_Include_preprocess  r=   r   c                  C   r>   )NZincludeT)r   r@   rA   r2   r2   r3   test_Include_postprocess  rC   r   c                   C   r5   )NFTr   r6   c                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:     r;   z%test_All_preprocess.<locals>.<lambda>)r   r9   r)   r#   r2   r2   r2   r3   test_All_preprocess  r=   r   c                  C   r>   )NallT)r   r@   rA   r2   r2   r3   test_All_postprocess  rC   r   c                  C   s&   dt i} t|  | dt iksJ d S )Ngen)r+   r   r@   rA   r2   r2   r3   test_Gen_postprocess  rC   r   c                   C   rh   )Nc                   S   r7   r8   )r   r9   r+   r2   r2   r2   r3   r:     r;   z)test_Symbols_preprocess.<locals>.<lambda>r)   r#   r2   r2   r2   r3   test_Symbols_preprocess  rl   r   c                  C   s2   dt ttgi} t|  | dt ttgiksJ d S )Nsymbols)r+   r,   r-   r   r@   rA   r2   r2   r3   test_Symbols_postprocess  s   
r   c                   C   rh   )Nc                   S   rL   )N
   )r   r9   r2   r2   r2   r3   r:     r;   z(test_Method_preprocess.<locals>.<lambda>r   r2   r2   r2   r3   test_Method_preprocess  rl   r   c                  C   r>   )NmethodZf5b)r   r@   rA   r2   r2   r3   test_Method_postprocess  rC   r   N)a__doc__Zsympy.polys.polyoptionsr   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zsympy.polys.orderingsr   Zsympy.polys.domainsr   r   r   r   r   r    r!   r"   Zsympy.polys.polyerrorsr#   r$   Zsympyr%   r&   r'   r(   Zsympy.testing.pytestr)   Z	sympy.abcr+   r,   r-   r4   r<   rB   rH   rI   rP   rQ   rR   rT   rU   rV   rW   rX   rY   rZ   rb   rf   rg   rk   rm   ro   rq   rs   rt   rx   ry   rz   r{   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r2   r2   r2   r3   <module>   sl    h(


@	










