
    2i/                         S SK rS SKrS SKrS SKJr  S SKJrJr  SSK	J
r
   " S S\
R                  \R                  5      r " S S	\
R                  \R                  5      r\S
:X  a  \R                   " 5         gg)    N)import_module)MultiplexedPathNamespaceReader   )utilc                   t   ^  \ rS rSrSrU 4S jrS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rSrU =r$ )MultiplexedPathTest   namespacedata01c                 ~  > [         TU ]  5         [        R                  " U R                  R
                  S   5      U l        [        R                  " U R                  S5      R                  5      R                  U l
        [        R                  " U R                  S5      R                  5      R                  U l        g )Nr   data01data02)supersetUppathlibPathdata__path__folderload_fixture__file__parentr   r   )self	__class__s    _/home/james-whalen/.local/lib/python3.13/site-packages/importlib_resources/tests/test_reader.pyr   MultiplexedPathTest.setUp   sy    ll499#5#5a#89ll4#4#4X#>#G#GHOOll4#4#4X#>#G#GHOO    c                 v    U R                  [        5         [        5         S S S 5        g ! , (       d  f       g = fN)assertRaisesFileNotFoundErrorr   r   s    r   test_init_no_paths&MultiplexedPathTest.test_init_no_paths   s#    01 211s   *
8c                     U R                  [        5         [        U R                  S-  5        S S S 5        g ! , (       d  f       g = f)Nbinary.file)r    NotADirectoryErrorr   r   r"   s    r   test_init_file"MultiplexedPathTest.test_init_file   s.    12DKK-78 322s	   8
Ac                     [        U R                  5      R                  5        Vs1 s H  oR                  iM     nn UR	                  S5        U R                  U1 Sk5        g s  snf ! [
        [        4 a     N,f = f)N__pycache__>   subdirectory
utf-8.filer&   utf-16.file)r   r   iterdirnameremoveKeyError
ValueErrorassertEqual)r   pathcontentss      r   test_iterdir MultiplexedPathTest.test_iterdir   sr    *9$++*F*N*N*PQ*P$II*PQ	OOM* 	R	
 R *% 		s   A$A) )A<;A<c                 (   [        U R                  U R                  5      R                  5        Vs1 s H  oR                  iM     nnS H  n UR                  U5        M     U R                  U1 Sk5        g s  snf ! [        [        4 a     MF  f = f)N)r+   z__init__.pyc>   r,   r-   __init__.pyr&   r.   )	r   r   r   r/   r0   r1   r2   r3   r4   )r   r5   r6   r1   s       r   test_iterdir_duplicate*MultiplexedPathTest.test_iterdir_duplicate&   s    "1$++t{{"K"S"S"U
"U$II"U 	 
 6F' 6
 	W	

 j) s   A8A==BBc                 j    U R                  [        U R                  5      R                  5       S5        g )NT)r4   r   r   is_dirr"   s    r   test_is_dirMultiplexedPathTest.test_is_dir4   s$    5<<>Er   c                 j    U R                  [        U R                  5      R                  5       S5        g )NF)r4   r   r   is_filer"   s    r   test_is_file MultiplexedPathTest.test_is_file7   s$    5==?Gr   c                    [        U R                  5      nU R                  [        5         UR	                  5         S S S 5        U R                  [        5         UR                  5         S S S 5        U R                  [        5         UR                  5         S S S 5        g ! , (       d  f       Nk= f! , (       d  f       NN= f! , (       d  f       g = fr   )r   r   r    r!   
read_bytes	read_textopenr   r5   s     r   test_open_file"MultiplexedPathTest.test_open_file:   s    t{{+01OO 201NN 201IIK 21	 211111s#   B!B2C!
B/2
C 
Cc                    [        U R                  R                  5      n[        U R                  U R                  5      nU R                  [        UR                  S5      5      [        U5      S-   S  [        R                  R                  SS5      5        UR                  S5      n[        U[        5      (       d   eS[        U5      ;   d   eS[        U5      ;   d   eU R                  [        UR                  S5      5      [        U5      S-   S  [        R                  R                  SS5      5        U R                  UR                  5       U5        g )Nr&   r   r   r,   r   	imaginary)strr   r   r   r   r4   joinpathlenosr5   join
isinstance)r   prefixr5   subs       r   test_join_path"MultiplexedPathTest.test_join_pathC   s   T[[''(t{{DKK8m,-c&kAo.?@GGLL*M:	
 mmN+#//// CH,,,3s8###k*+CK!O,=>GGLL*K8	
 	$/r   c                 z    [        U R                  5      nUR                  S5      R                  5       (       a   eg )Nzimaginary/foo.py)r   r   rO   existsrI   s     r   test_join_path_compound+MultiplexedPathTest.test_join_path_compoundT   s2    t{{+==!34;;=====r   c                 ~   [        U R                  R                  5      n[        U R                  U R                  5      nU R                  UR                  S5      [        5        U R                  [        UR                  SS5      5      [        U5      S-   S  [        R                  R                  SSS5      5        g )Nr,   	subsubdirr   r   )rN   r   r   r   r   assertIsInstancerO   r4   rP   rQ   r5   rR   )r   rT   r5   s      r   test_join_path_common_subdir0MultiplexedPathTest.test_join_path_common_subdirX   s    T[[''(t{{DKK8dmmN;_Mnk:;CK!O<MNGGLL>;?	
r   c                 |    U R                  [        [        U R                  5      5      SU R                   S35        g )NMultiplexedPath(''))r4   reprr   r   r"   s    r   	test_reprMultiplexedPathTest.test_repra   s1    -.}B/	
r   c                     U R                  [        U R                  5      R                  [        R
                  R                  U R                  5      5        g r   )r4   r   r   r0   rQ   r5   basenamer"   s    r   	test_nameMultiplexedPathTest.test_nameg   s8    DKK(--GGT[[)	
r   )r   r   r   )__name__
__module____qualname____firstlineno__MODULEr   r#   r(   r7   r;   r?   rC   rJ   rV   rZ   r_   re   ri   __static_attributes____classcell__)r   s   @r   r	   r	      sQ    FP9

FH0">


 
r   r	   c                   *    \ rS rSrSrS rS rS rSrg)NamespaceReaderTestn   r   c                 |    U R                  [        5         [        SS/5        S S S 5        g ! , (       d  f       g = f)Npath1path2)r    r3   r   r"   s    r   test_init_error#NamespaceReaderTest.test_init_errorq   s)    z*Wg./ +**s   -
;c                    [        S5      n[        UR                  R                  5      nU R                  R
                  S   nU R                  UR                  S5      [        R                  R                  US5      5        U R                  UR                  S5      [        R                  R                  US5      5        g )Nr   r   r&   rM   )r   r   __spec__submodule_search_locationsr   r   r4   resource_pathrQ   r5   rR   )r   r   readerroots       r   test_resource_path&NamespaceReaderTest.test_resource_pathu   s    '(9: !9!9!T!TUyy!!!$  /dM1R	
 	  -rww||D+/N	
r   c                 *   [        U R                  R                  R                  5      nU R                  R                  S   nU R                  UR                  5       [        5        U R                  [        UR                  5       5      SU S35        g )Nr   rb   rc   )
r   r   r{   r|   r   r^   filesr   r4   rd   )r   r~   r   s      r   
test_filesNamespaceReaderTest.test_files   sk     !3!3!N!NOyy!!!$fllno>flln-1B4&/KLr    N)	rk   rl   rm   rn   ro   rx   r   r   rp   r   r   r   rs   rs   n   s    F0

Mr   rs   __main__)os.pathrQ   r   unittest	importlibr   importlib_resources.readersr   r    r   	DiskSetupTestCaser	   rs   rk   mainr   r   r   <module>r      sd       # H `
$..(*;*; `
FM$..(*;*; M4 zMMO r   