
    9i                        S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	J
r
Jr  S SKJr  S SKJr  SrS rS rS	 r\R(                  R+                  \S
S9S 5       rS rS r\R(                  R3                  S\\\\/5      S 5       r\R(                  R3                  SSS0SS0SS0/5      S 5       r\R(                  R3                  SSS0SS0SS0/5      S 5       r \R(                  R3                  SSS0SS0/5      S 5       r!g)    N)io)assert_array_equalfetchassert_stacklevel)is_wasm)data_dirs    JFIF       C 	

			

		
                     	                    ? *c                      [         R                  " S5      R                  SS5      n [        R                  " U 5        [        [        R                  " 5       U 5        g )N         )nparangereshaper   pushr   pop)xs    X/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/io/tests/test_io.pytest_stack_basicr      s7    
		"a#AGGAJrvvx#    c                      [         R                  " [        5         [        R                  " / SQ/5        S S S 5        g ! , (       d  f       g = f)N)      r   )pytestraises
ValueErrorr   r    r   r   test_stack_non_arrayr   %   s(    	z	"
 
#	"	"s	   >
Ac                      [        [        S5      5      n U R                  [        R                  R
                  S5      n SU  3n[        R                  " U5      nUR                  S:X  d   eg )Ndata/camera.png/file:///)   r"   )	strr   replaceospathsepr   imreadshape)	data_path	image_urlimages      r   test_imread_file_urlr-   *   sX    E+,-I!!"''++s3I9+&IIIi E;;*$$$r   zno access to pytest-localserver)reasonc                     U R                  [        5        [        R                  " U R                  S-   S-   S-   5      nUR
                  S:X  d   eg )Nz	/test.jpg?
  ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss)r   r   )serve_contentone_by_one_jpegr   r(   urlr)   )
httpserverr,   s     r   test_imread_http_urlr6   3   sG     _- IIjnn{2S89DEE;;&   r   c                      [        S5      n [        R                  " U 5      n[        R                  " U 5      n[        R                  " U5      nUR
                  S:X  d   e[        X5        g)z/Tests reading from Path object (issue gh-5545).data/multipage.tif)r      
   N)r   r   r(   pathlibPathr)   r   )fnameexpectedr&   imgs       r   test_imread_pathlib_tiffr@   ?   sT     &'EyyH <<D
))D/C99###x%r   c                    ^  U 4S jnU$ )a  Create a mock function for NamedTemporaryFile that always raises.

Parameters
----------
error_class : exception class
    The error that should be raised when asking for a NamedTemporaryFile.

Returns
-------
named_temp_file : callable
    A function that always raises the desired error.

Notes
-----
Although this function has general utility for raising errors, it is
expected to be used to raise errors that ``tempfile.NamedTemporaryFile``
from the Python standard library could raise. As of this writing, these
are ``FileNotFoundError``, ``FileExistsError``, ``PermissionError``, and
``BaseException``. See
`this comment <https://github.com/scikit-image/scikit-image/issues/3785#issuecomment-486598307>`__
for more information.
c                     > T" 5       e)Nr   )argskwargserror_classs     r   named_temp_file-_named_tempfile_func.<locals>.named_temp_filef   s    mr   r   )rE   rF   s   ` r   _named_tempfile_funcrH   N   s    0 r   rE   c                    [        S5        [        R                  " [        R                  R
                  5      nUR                  [        R                  R
                  S5      nSU S3nU R                  5          U R                  [        S[        U5      5        [        R                  " U5         [        R                  " U5        S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nr   r    r!   z/camera.pngNamedTemporaryFile)r   r   lstripr%   r&   r'   r$   contextsetattrtempfilerH   r   r   r   r(   )monkeypatchrE   r*   r+   s       r   test_failed_temporary_filerP   l   s     

,I!!"''++s3I9+[1I				*,@,M	
 ]];'IIi  (	 
	 ('	 
	s$   :7C*1CC*
C'	#C**
C8kwargpluginimageiomoderc                     [        S5      nSn[        R                  " [        US9 n[        R
                  " U40 U D6  S S S 5        [        W5      S:X  d   e[        USS9  g ! , (       d  f       N*= f)Nr8   0.*use `imageio` or other I/O packages directly.*matchr   offset)r   r   warnsFutureWarningr   r(   lenr   )rQ   r&   regexrecords       r   !test_plugin_deprecation_on_imreadrb   }   s_     %&D>E	m5	1V
		$ %  
2v;!fR( 
2	1s   A##
A1appendFc                    US-  n[         R                  " SS/[        S9nSn[        R                  " [
        US9 n[        R                  " X#40 U D6  S S S 5        [        W5      S:X  d   e[        USS9  g ! , (       d  f       N*= f)	Nztest.tifr   r   )dtyperW   rX   rZ   r[   )
r   arrayfloatr   r]   r^   r   imsaver_   r   )rQ   tmp_pathr&   rf   r`   ra   s         r   !test_plugin_deprecation_on_imsaverj      sr     j DHHaV5)E>E	m5	1V
		$'' 
2v;!fR( 
2	1s   A88
Bc                     [         S-   nSn[        R                  " [        US9 n[        R
                  " U40 U D6  S S S 5        [        W5      S:X  d   e[        USS9  g ! , (       d  f       N*= f)Nz*.pngrW   rX   r   rZ   r[   )r   r   r]   r^   r   imread_collectionr_   r   )rQ   patternr`   ra   s       r   ,test_plugin_deprecation_on_imread_collectionrn      s^     G>E	m5	1V
W.. 
2v;!fR( 
2	1s   A!!
A/)"r%   r;   rN   numpyr   r   skimager   skimage._shared.testingr   r   r   "skimage._shared._dependency_checksr   skimage.datar   r3   r   r   r-   markskipifr6   r@   rH   parametrizeFileNotFoundErrorFileExistsErrorPermissionErrorBaseExceptionrP   rb   rj   rn   r   r   r   <module>r{      sT   	      P P 6 !  $
% G$EF! G!&< %W!! ),vsm<
)
) ),x.?@
)
) Hd#3h	5J"KL) M)r   