o
    oh(                     @   s   d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z
 d dl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 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 )    )purestrstyleof	attrprintdotnodedotedgesdotprint)Basic)Expr)FloatInteger)S)Symbolsymbols)srepr)xc                   C   s   t tddks
J t ttdtddksJ t tddks#J t tdddd	ks/J t ttdtdddd
ks@J t tddddksLJ d S )Nr   Symbol('x')      Basic(Integer(1), Integer(2))Float('2.0', precision=53)T)	with_args)r    )r   )z
Integer(1)
Integer(2))r   r   )r   r   r   r   r
   r   r   r   q/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/printing/tests/test_dot.pytest_purestr   s   r   c                  C   sZ   t dddftddifg} tt td| dddksJ ttd | dddks+J d S )Nblueellipsecolorshaper   blackr   )r   r	   r   r   r   )stylesr   r   r   test_styleof   s
   
  r"   c                   C   s   t ddddksJ d S )Nr   r   r   z!"color"="blue", "shape"="ellipse")r   r   r   r   r   test_attrprint    s   r#   c                   C   sx   t tdddks
J t td dddksJ t td ddt ttd  dddks,J t ttd  ddd	ks:J d S )
NFrepeatz@"Symbol('x')" ["color"="black", "label"="x", "shape"="ellipse"];r   zS"Add(Integer(2), Symbol('x'))" ["color"="black", "label"="Add", "shape"="ellipse"];r   ze"Add(Symbol('x'), Pow(Symbol('x'), Integer(2)))" ["color"="black", "label"="Add", "shape"="ellipse"];Tzh"Add(Symbol('x'), Pow(Symbol('x'), Integer(2)))_()" ["color"="black", "label"="Add", "shape"="ellipse"];)r   r   r   r   r   r   test_dotnode$   s   
r&   c                   C   sD   t ttd ddddgksJ t ttd ddddgks J d S )	Nr   Fr$   z/"Add(Integer(2), Symbol('x'))" -> "Integer(2)";z0"Add(Integer(2), Symbol('x'))" -> "Symbol('x')";Tz7"Add(Integer(2), Symbol('x'))_()" -> "Integer(2)_(0,)";z8"Add(Integer(2), Symbol('x'))_()" -> "Symbol('x')_(1,)";)sortedr   r   r   r   r   r   test_dotedges4   s   
r(   c                      s  t td dd t fddttd ddD sJ t fdddd ttdtd fD D s4J d	 v s:J t ttd  dd t fd
dtttd  ddD sYJ t fdddd ttdtd fD D srJ d	 v sxJ t ttd  dd t fddtttd  ddD sJ t fdddd ttd  fD D sJ t tt dd t fddttt ddD sJ t fddttddttddfD sJ d	 v sJ d S )Nr   Fr$   c                 3       | ]}| v V  qd S Nr   .0etextr   r   	<genexpr>@       z test_dotprint.<locals>.<genexpr>c                 3   r)   r*   r   r,   nr.   r   r   r0   A       
c                 S      g | ]}t |d dqS Fr$   r   r,   exprr   r   r   
<listcomp>B       z!test_dotprint.<locals>.<listcomp>digraphc                 3   r)   r*   r   r+   r.   r   r   r0   G   r1   c                 3   r)   r*   r   r2   r.   r   r   r0   H   r4   c                 S   r5   r6   r7   r8   r   r   r   r:   I   r;   Tc                 3   r)   r*   r   r+   r.   r   r   r0   N   r1   c                 3   r)   r*   r   r2   r.   r   r   r0   O   r4   c                 S   r5   )r   posr7   r8   r   r   r   r:   P   r;   c                 3   r)   r*   r   r+   r.   r   r   r0   T   r1   c                 3   r)   r*   r   r2   r.   r   r   r0   U   r4   )r   r=   )r   )r   r   allr   r   r   r   r   r.   r   test_dotprint>   s:   &**&r@   c                  C   s\   t dt d dd} tdt d | v sJ tt| vsJ t dt d } d| vs,J d S )N   r   r   )depthrB   )r   r   r   r.   r   r   r   test_dotprint_depthY   s
   rC   c                  C   s0   ddl m}  td}t| d||dksJ d S )Nr   )MatrixSymbolr3   Xa  digraph{

# Graph style
"ordering"="out"
"rankdir"="TD"

#########
# Nodes #
#########

"MatrixSymbol(Str('X'), Symbol('n'), Symbol('n'))_()" ["color"="black", "label"="MatrixSymbol", "shape"="ellipse"];
"Str('X')_(0,)" ["color"="blue", "label"="X", "shape"="ellipse"];
"Symbol('n')_(1,)" ["color"="black", "label"="n", "shape"="ellipse"];
"Symbol('n')_(2,)" ["color"="black", "label"="n", "shape"="ellipse"];

#########
# Edges #
#########

"MatrixSymbol(Str('X'), Symbol('n'), Symbol('n'))_()" -> "Str('X')_(0,)";
"MatrixSymbol(Str('X'), Symbol('n'), Symbol('n'))_()" -> "Symbol('n')_(1,)";
"MatrixSymbol(Str('X'), Symbol('n'), Symbol('n'))_()" -> "Symbol('n')_(2,)";
})"sympy.matrices.expressions.matexprrD   r   r   )rD   r3   r   r   r   test_Matrix_and_non_basics`   s
   rG   c                  C   s,   t td td} d| v sJ d| v sJ d S )Nr   )	labelfuncr   r   )r   r   r   r.   r   r   r   test_labelfunc}   s   rI   c                  C   sL   t ddd\} }t| | t||  ksJ t| | t||  ks$J d S )Nzx yF)commutative)r   r   )r   yr   r   r   test_commutative   s    rL   N)!sympy.printing.dotr   r   r   r   r   r   sympy.core.basicr   sympy.core.exprr	   sympy.core.numbersr
   r   sympy.core.singletonr   sympy.core.symbolr   r   sympy.printing.reprr   	sympy.abcr   r   r"   r#   r&   r(   r@   rC   rG   rI   rL   r   r   r   r   <module>   s$     
