a
    kh                     @   s  d dl mZ d dl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mZ d dlmZ d dlmZ d d	lmZ d d
lmZmZ ed\ZZdd Zdd Zdd Zdd Zdd Zdd Z dd Z!dd Z"dd Z#dd Z$d d! Z%d"d# Z&d$d% Z'd&d' Z(d(S ))    )Product)Sum)
DerivativeFunction)IntegerRationalFloatoo)Rel)symbols)sin)Integral)Order)
precedence
PRECEDENCEzx,yc                   C   s8   t tt td ksJ t tt d td ks4J d S )NAdd   r   xyr    r   r   R/var/www/auris/lib/python3.9/site-packages/sympy/printing/tests/test_precedence.pytest_Add   s    r   c                   C   s   t tttd ksJ d S )NFunc)r   r   r   r   r   r   r   r   test_Function   s    r   c                   C   s   t ttttd ksJ d S NAtom)r   r   r   r   r   r   r   r   r   test_Derivative   s    r   c                   C   s   t ttttd ksJ d S r   )r   r   r   r   r   r   r   r   r   test_Integral   s    r   c                   C   s6   t tt td ksJ t t t td ks2J d S )NMulr   r   r   r   r   r   test_Mul   s    r    c                   C   s   t tdtd ksJ t tdtd ks0J t tdtd ksHJ t tdtd ks`J t tddtd	 kszJ t td
dtd ksJ t tdtd ksJ t td
td ksJ t ttd ksJ t t td ksJ d S )Nr   r   r   r   
         r   )r   r   r   r   r   r	   r   r   r   r   test_Number$   s    r&   c                   C   s   t tttd ksJ d S r   )r   r   r   r   r   r   r   r   
test_Order1   s    r'   c                   C   sP   t tt td ksJ t tt  td ks2J t tt  td ksLJ d S )NPowr   r   r   r   r   r   test_Pow5   s    r)   c                   C   s(   t tttttd ftd ks$J d S Nr   r   )r   r   r   r   r   r   r   r   r   test_Product;   s    r+   c                   C   s$   t ttt tdtd ks J d S )N<Z
Relational)r   r
   r   r   r   r   r   r   r   test_Relational?   s    r-   c                   C   s(   t tttttd ftd ks$J d S r*   )r   r   r   r   r   r   r   r   r   test_SumC   s    r.   c                   C   s   t ttd ksJ d S r   )r   r   r   r   r   r   r   test_SymbolG   s    r/   c                   C   s(  t tt@ t ttB ksJ t t t tt@ ks6J t tt t ttB ksRJ t tt t tt@ ksnJ t tt t ttB ksJ t tt t tt@ ksJ t t t tt ksJ t t t tt ksJ t tt@ td ksJ t ttB td ksJ t t td ks$J d S )NAndOrNotr   r   r   r   r   test_And_OrK   s    r3   c                     sH   G dd dt G dd dt  fdd}  fdd}|   |  d	S )
a_  
    Test cases for custom functions with different precedence values,
    specifically handling:
    1. Functions with precedence < PRECEDENCE["Mul"] (50)
    2. Functions with precedence = Func (70)

    Key distinction:
    1. Lower precedence functions (45) need parentheses: -2*(x F y)
    2. Higher precedence functions (70) don't: -2*x F y
    c                   @   s    e Zd Zed d Zdd ZdS )zBtest_custom_function_precedence_comparison.<locals>.LowPrecedenceFr   r#   c                 S   s&   | | jd  d| | jd  S Nr   z F r   Z_printargsselfprinterr   r   r   	_sympystri   s    zLtest_custom_function_precedence_comparison.<locals>.LowPrecedenceF._sympystrN__name__
__module____qualname__r   r   r:   r   r   r   r   LowPrecedenceFg   s   r?   c                   @   s   e Zd Zed Zdd ZdS )zCtest_custom_function_precedence_comparison.<locals>.HighPrecedenceFr   c                 S   s&   | | jd  d| | jd  S r4   r5   r7   r   r   r   r:   n   s    zMtest_custom_function_precedence_comparison.<locals>.HighPrecedenceF._sympystrNr;   r   r   r   r   HighPrecedenceFl   s   r@   c                     s@   d t t } t| dksJ d t t }t|dks<J d S )Nr$   z	2*(x F y)z
-2*(x F y)r   r   strexpr1Zexpr2)r?   r   r   test_low_precedenceq   s    zGtest_custom_function_precedence_comparison.<locals>.test_low_precedencec                     s@   d t t } t| dksJ d t t }t|dks<J d S )Nr$   z2*x F yrA   z-2*x F yrB   rD   )r@   r   r   test_high_precedencex   s    zHtest_custom_function_precedence_comparison.<locals>.test_high_precedenceN)r   )rF   rG   r   )r@   r?   r   *test_custom_function_precedence_comparison\   s    rH   N))Zsympy.concrete.productsr   Zsympy.concrete.summationsr   Zsympy.core.functionr   r   Zsympy.core.numbersr   r   r   r	   Zsympy.core.relationalr
   Zsympy.core.symbolr   Zsympy.functionsr   Zsympy.integrals.integralsr   Zsympy.series.orderr   Zsympy.printing.precedencer   r   r   r   r   r   r   r   r    r&   r'   r)   r+   r-   r.   r/   r3   rH   r   r   r   r   <module>   s0   