a
    ëÝEbÞ  ã                   @   sb   d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dlm	Z	 ej
 dg d¢¡dd	„ ƒZdS )
é    )ÚPathN)Úapprox)Úcompare_imagesÚmake_test_filename)Ú_image_directorieszim1, im2, tol, expect_rms))úbasn3p02.pngúbasn3p02-minorchange.pngé
   N)r   r   r   g»íBs�@)r   zbasn3p02-1px-offset.pngr   g%Ì´ý‰V@)r   zbasn3p02-half-1px-offset.pngr   g     àO@)r   zbasn3p02-scrambled.pngr   g‘D/£X”e@)ú
all127.pngú
all128.pngr   é   )r   r
   r   r   c           	      C   sš   t ttdd„ ƒƒ\}}t||  dƒ}t ||  |¡ ||  }t || |¡ t|||dd�}|du rr|du s–J ‚n$|dus~J ‚|d t|dd	�ks–J ‚dS )
a   
    Compare two images, expecting a particular RMS error.

    im1 and im2 are filenames relative to the baseline_dir directory.

    tol is the tolerance to pass to compare_images.

    expect_rms is the expected RMS value, or None. If None, the test will
    succeed if compare_images succeeds. Otherwise, the test will succeed if
    compare_images fails and returns an RMS error almost equal to this value.
    c                   S   s   dS )NÚdummy© r   r   r   úd/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/matplotlib/tests/test_compare_images.pyÚ<lambda>9   ó    z2test_image_comparison_expect_rms.<locals>.<lambda>ÚexpectedT)ÚtolZin_decoratorNZrmsg-Cëâ6?)Úabs)Úmapr   r   r   ÚshutilÚcopyfiler   r   )	Zim1Zim2r   Z
expect_rmsZbaseline_dirZ
result_dirZ
result_im1Z
result_im2Úresultsr   r   r   Ú test_image_comparison_expect_rms   s    -ÿr   )Úpathlibr   r   Zpytestr   Zmatplotlib.testing.comparer   r   Zmatplotlib.testing.decoratorsr   ÚmarkZparametrizer   r   r   r   r   Ú<module>   s   þ!