
    daf(                         d dl Z d dlZd dlZd dlZd dlZd dlZd dlZddlmZ ddl	m
Z
 ddlmZ  ed      Z ed      Z G d d	ej                        Zy)
    N   )compose)consume)import_or_skipbig_opytestc                   \   e Zd Zej                  j
                  d        Zddej                  fdZ	e
ej                  fd       Ze
d        Ze
d        Zd Zej                  j
                  d        Zej                  j
                  d	        Zej                  j
                  d
        Zy)TestComplexityc                     t         j                  t        t        t        j                  j
                  j                        d dd      \  }}|t         j                  j                  k  sJ y )Nc           	          t        |       D cg c]-  }dj                  t        j                  t	        |      z         / c}S c c}w )N/)rangejoinstringascii_lowercasestr)sizens     B/root/Python-3.12.4/Lib/test/test_zipfile/_path/test_complexity.py<lambda>z>TestComplexity.test_implied_dirs_performance.<locals>.<lambda>   s8    CH;>?//#a&89  s   2Ai  r   max_nmin_n)	r   r   r   zipfile_pathCompleteDirs_implied_dirscomplexitiesLinearselfbestotherss      r   test_implied_dirs_performancez,TestComplexity.test_implied_dirs_performance   s\    {{GW]]77EEF  # 
f u))00000    returnc                 6   t        j                  t        j                         d      }t	        j
                  | j                  |      | j                  |            }|D ]  \  }}|j                  | | dd        d|_	        t        j                  |      S )zL
        Construct a Path with width files at every level of depth.
        w)modez.txtr%   z
big un.zip)r   ZipFileioBytesIO	itertoolsproductmake_deep_paths
make_nameswritestrfilenamePath)r!   depthwidthzfpairspathnames          r   make_zip_pathzTestComplexity.make_zip_path    s     __RZZ\4!!$"6"6u"=tu?UV 	2JD$KK4&d+S1	2"||Br%   c                     t        j                  t        j                  |t        |                  }|f|z  }t	        j
                  | }t        dj                  |      }t	        j                  ||      S )z
        >>> list(TestComplexity.make_names(2))
        ['a', 'b']
        >>> list(TestComplexity.make_names(30))
        ['aa', 'ab', ..., 'bd']
         )	mathceilloglenr-   r.   mapr   islice)clsr5   letters
n_productsinputscombinationsnamess          r   r0   zTestComplexity.make_names+   s`     YYtxxs7|<=
j( ((&1BGG\*u--r%   c                 @    t        | j                  t        |            S )N)rA   make_deep_pathr   rC   r4   s     r   r/   zTestComplexity.make_deep_paths:   s    3%%uU|44r%   c                 *    dj                  d|z        S )Nr<   )zd/)r   rK   s     r   rJ   zTestComplexity.make_deep_path>   s    www''r%   c                     t         j                  d | j                  dd      \  }}|t         j                  j                  k  sJ y )Nc                 .    t        j                  d|       S )Nz[^/]*\\.txt)re	fullmatchr8   s    r   r   z?TestComplexity.test_baseline_regex_complexity.<locals>.<lambda>D   s    nd; r%   d   r   r   )r   rJ   r   Constantr    s      r   test_baseline_regex_complexityz-TestComplexity.test_baseline_regex_complexityB   sG    {{;	 # 
f u))22222r%   c                     t         j                  d | j                  dd      \  }}|t         j                  j                  k  sJ y )Nc                 6    t        | j                  d            S Nz*.txtr   globrQ   s    r   r   z0TestComplexity.test_glob_depth.<locals>.<lambda>N       7!34 r%   rR   r   r   )r   r:   r   	Quadraticr    s      r   test_glob_depthzTestComplexity.test_glob_depthK   sG    {{4	 # 
f u))33333r%   c                      t         j                  d  fddd      \  }}|t         j                  j                  k  sJ y )Nc                 6    t        | j                  d            S rW   rX   rQ   s    r   r   z0TestComplexity.test_glob_width.<locals>.<lambda>X   rZ   r%   c                 (    j                  |       S )N)r5   r:   r   r!   s    r   r   z0TestComplexity.test_glob_width.<locals>.<lambda>Y   s    ++$+7 r%   rR   r   r   r   r   r   r    s   `  r   test_glob_widthzTestComplexity.test_glob_widthU   sB    {{47	 # 
f u))00000r%   c                      t         j                  d  fddd      \  }}|t         j                  j                  k  sJ y )Nc                 6    t        | j                  d            S rW   rX   rQ   s    r   r   z:TestComplexity.test_glob_width_and_depth.<locals>.<lambda>b   rZ   r%   c                 *    j                  | |       S )N)r4   r5   r`   ra   s    r   r   z:TestComplexity.test_glob_width_and_depth.<locals>.<lambda>c   s    ++$d+C r%   
   r   r   rb   r    s   `  r   test_glob_width_and_depthz(TestComplexity.test_glob_width_and_depth_   sB    {{4C	 # 
f u))00000r%   N)r   r   )__name__
__module____qualname__r   markflakyr$   r   r3   r:   classmethodr   r   r0   r/   rJ   rT   r\   rc   rh    r%   r   r
   r
      s    [[	1 	1	  	  '-'='= . . 5 5 ( (3 [[4 4 [[1 1 [[1 1r%   r
   )r+   r-   r=   rO   r   unittestr   
_functoolsr   
_itertoolsr   _supportr   r   r   TestCaser
   ro   r%   r   <module>ru      sM    	   	      $ 	w		!T1X&& T1r%   