o
    h                     @   sf   d dl mZ d dlmZ d dlZd dlmZ d dlmZm	Z
 edgddd	d
 Zdd Zdd ZdS )    )BytesIO)PathN)image_comparison)cmpyplotzpngsuite.pngg{Gz?)tolc                  C   s   t ttjd d} tjt| dfd t| D ]"\}}t	|}d }|j
dkr-tj}tj|||d ddf|dd qt jd	 t dt|  d S )
Nzbaseline_images/pngsuitez	basn*.png   )figsize   r   data)extentcmapinterpolation_stagez#ddffff)sortedr   __file__parentglobpltfigurelen	enumerateimreadndimr   grayimshowgcapatchset_facecolorset_xlim)filesifnamer   r    r"   m/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/matplotlib/tests/test_png.pytest_pngsuite
   s   

r$   c                 C   s   | d }| d }t | t|d}| }W d    n1 s!w   Y  t|d}||d d  W d    n1 s?w   Y  tt t | W d    d S 1 sZw   Y  d S )Nztest.pngztest_truncated.pngrbwb   )	r   savefigopenreadwritepytestraises	Exceptionr   )tmp_pathpathpath_tfinbuffoutr"   r"   r#   test_truncated_file    s   

"r5   c                  C   sl   t  } t|  | d t | d}|d tt t| W d    d S 1 s/w   Y  d S )Nr   r'   )	r   r   r(   seekr*   r,   r-   r.   r   )bb2r"   r"   r#   test_truncated_buffer-   s   


"r9   )ior   pathlibr   r,   matplotlib.testing.decoratorsr   
matplotlibr   r   r   r$   r5   r9   r"   r"   r"   r#   <module>   s    
