
    
3j                         S SK Jr  S SKrS SKrS SKrS SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  \R                  R!                  S/ S	Q5      S
 5       rS rg)    )PathN)approx)_image)compare_images)_image_directories)ImageComparisonFailurezim1, im2, tol, expect_rms))basn3p02.pngbasn3p02-minorchange.png
   N)r	   r
   r   gBs@)r	   zbasn3p02-1px-offset.pngr   g%̴V@)r	   zbasn3p02-half-1px-offset.pngr   g     O@)r	   zbasn3p02-scrambled.pngr   gD/Xe@)
all127.png
all128.pngr      )r   r   r   r   c                     UR                  U5        [        [        [        S 5      5      u  pgXp-  n[        R
                  " Xa-  U5        [        X`-  XSS9n	Uc  U	b   egU	c   eU	S   [        USS9:X  d   eg)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                      g)Ndummy r       ^/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/tests/test_compare_images.py<lambda>2test_image_comparison_expect_rms.<locals>.<lambda>@   s    Gr   T)tolin_decoratorNrmsg-C6?)abs)chdirmapr   r   shutilcopyfiler   r   )
im1im2r   
expect_rmstmp_pathmonkeypatchbaseline_dir
result_dir
result_im2resultss
             r    test_image_comparison_expect_rmsr(      s    ` h"4);O)LML !J
OOL&
3JdDG """u~
!====r   c            
         [         R                  " S[         R                  S9n [        R                  " [
        SS9   [        R                  " U S S 2S S 2S4   U 5        S S S 5        [        R                  " [
        SS9   [        R                  " X S S 2S S 2S S 2[         R                  [         R                  4   5        S S S 5        [        R                  " [
        SS9   [        R                  " U S S 2S S 2S S24   U 5        S S S 5        [        R                  " [
        S	S9   [        R                  " X S S
2S S 2S S 24   5        S S S 5        [        R                  " [
        SS9   [        R                  " X S S 2S S2S S 24   5        S S S 5        [        R                  " [
        SS9   [        R                  " X S S 2S S 2S S24   5        S S S 5        g ! , (       d  f       GN= f! , (       d  f       GN3= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g = f)N)   r*      )dtypez+must be 3-dimensional, but is 2-dimensional)matchr   z+must be 3-dimensional, but is 5-dimensionalz#must be RGB or RGBA but has depth 2   z5expected size: \(16, 16, 4\) actual size \(8, 16, 4\)   z5expected size: \(16, 16, 4\) actual size \(16, 6, 4\)   z6expected size: \(16, 16, 4\) actual size \(16, 16, 3\)   )	npzerosuint8pytestraisesr   r   calculate_rms_and_diffnewaxis)imgs    r   test_invalid_inputr:   O   s   
((;bhh
/C	-J
L%%c!Q'lC8
L 
-J
L%%cq!Q

BJJ/N+OP
L 
-B
D%%c!Q(mS9
D 
-U
W%%crr1ax=9
W 
-U
W%%cq"1"ax=9
W 
-V
X%%cq!RaRx=9
X 
X!
L 
L
L 
L
D 
D
W 
W
W 
W
X 
XsH   "G AG-"$G?'#H+#H!/#H2
G*-
G<?
H
H!
H/2
I )pathlibr   r   numpyr2   r5   r   
matplotlibr   matplotlib.testing.comparer   matplotlib.testing.decoratorsr   matplotlib.testing.exceptionsr   markparametrizer(   r:   r   r   r   <module>rC      sS          5 < @  B>C B>>:r   