
    G8c                     n    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	        Zd
 Zd Zy)    )BytesIO)PathN)image_comparison)cmpyplotzpngsuite.pnggQ?)tolc                  2   t        t        t              j                  dz  j	                  d            } t        j                  t        |       df       t        |       D ]Z  \  }}t        j                  |      }d }|j                  dk(  rt        j                  }t        j                  |||dz   ddg|       \ t        j                         j                  j!                  d       t        j                         j#                  dt        |              y )	Nzbaseline_images/pngsuitez	basn*.png   )figsize   r   )extentcmapz#ddffff)sortedr   __file__parentglobpltfigurelen	enumerateimreadndimr   grayimshowgcapatchset_facecolorset_xlim)filesifnamedatar   s        ;/usr/lib/python3/dist-packages/matplotlib/tests/test_png.pytest_pngsuiter$   
   s    	h		!;	;AA+NPE JJE
A'e$ =5zz% 99>77D

4AE1a 0t<= GGIOO!!),GGIq#e*%    c                 
   | j                  d      }t        |j                  d            }t        |j                  d            }t        j                  |       t        |d      5 }|j                         }d d d        t        |d      5 }|j                  d d        d d d        t        j                  t              5  t        j                  |       d d d        y # 1 sw Y   jxY w# 1 sw Y   MxY w# 1 sw Y   y xY w)Ntestztest.pngztest_truncated.pngrbwb   )mkdirstrjoinr   savefigopenreadwritepytestraises	Exceptionr   )tmpdirdr!   fname_tfinbuffouts          r#   test_truncated_filer;      s    VAz"#E!&&-./GKK	eT	 chhj	gt	 

3s8 
y	! 

7    s$   'C!C-C9!C*-C69Dc                  @   t               } t        j                  |        | j                  d       t        | j	                  d            }|j                  d       t        j                  t              5  t        j                  |       d d d        y # 1 sw Y   y xY w)Nr   r*   )	r   r   r.   seekr0   r2   r3   r4   r   )bb2s     r#   test_truncated_bufferr@   +   sh    	AKKNFF1I		BGGAJ	y	! 

2  s   5BB)ior   pathlibr   r2   matplotlib.testing.decoratorsr   
matplotlibr   r   r   r$   r;   r@    r%   r#   <module>rF      s<       : ( >"-& .&$r%   