
    &e                         d Z ddlZddlZddlZddlmZ ddlmc mZ	  ee
                                          j        Z e ej        d                    Zej        Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd ZdS )z'Tests for IPython.utils.module_paths.py    N)Pathzwith.dot)suffixc                 N    t          | dd                                           d S )Nwzutf-8)encoding)openclose)fnames    Elib/python3.11/site-packages/IPython/utils/tests/test_module_paths.pymake_empty_filer       s)    g&&&,,.....    c                     t          t          dz                                d           t          t          dz                                d           t          t          dz             t          t          dz             t          t          dz             t          t          dz             t	          t                    gt
          _        d	S )
z+Setup testenvironment for the module:

    xmodT)parentsnomodzxmod/__init__.pyzxmod/sub.pypack.pyzpackpyc.pycN)r   TMP_TEST_DIRmkdirr   strsyspath r   r   setup_moduler   $   s     		%%d%333	  &&t&444L#55666L=0111L9,---L=0111L!!"CHHHr   c                  Z    t          j        t                     t          t          _        dS )zZTeardown testenvironment for the module:

    - Remove tempdir
    - restore sys.path
    N)shutilrmtreer   old_syspathr   r   r   r   r   teardown_moduler   2   s     M,CHHHr   c                  6    dt          t                    v sJ dS )zS
    Ensure the test are done with a temporary file that have a dot somewhere.
    .N)r   r   r   r   r   test_tempdirr!   >   s#     #l########r   c                  n    t           dz  dz  } t          t          j        d                    | k    sJ dS )zo
    Search for a directory's file path.
    Expected output: a path to that directory's __init__.py file.
    r   __init__.pyNr   r   mpfind_modmodpaths    r   test_find_mod_1r)   E   s<    
 V#m3GF##$$//////r   c                  n    t           dz  dz  } t          t          j        d                    | k    sJ dS )z
    Search for a directory's file path.
    Expected output: a path to that directory's __init__.py file.
    TODO: Confirm why this is a duplicate test.
    r   r#   Nr$   r'   s    r   test_find_mod_2r+   M   s<     V#m3GF##$$//////r   c                  n    t           dz  dz  } t          t          j        d                    | k    sJ dS )zz
    Search for a directory + a filename without its .py extension
    Expected output: full path with .py extension.
    r   zsub.pyzxmod.subNr$   r'   s    r   test_find_mod_3r-   V   s<    
 V#h.GJ''((G333333r   c                  h    t           dz  } t          t          j        d                    | k    sJ dS )zk
    Search for a filename without its .py extension
    Expected output: full path with .py extension
    r   packNr$   r'   s    r   test_find_mod_4r0   ^   s7    
 Y&GF##$$//////r   c                  :    t          j        d          dk    sJ dS )zu
    Search for a filename with a .pyc extension
    Expected output: TODO: do we exclude or include .pyc files?
    packpycN)r%   r&   r   r   r   test_find_mod_5r3   f   s%    
 ;y!!T))))))r   )__doc__r   r   tempfilepathlibr   IPython.utils.module_pathsutilsmodule_pathsr%   __file__resolveparentTEST_FILE_PATHmkdtempr   r   r   r   r   r   r!   r)   r+   r-   r0   r3   r   r   r   <module>r?      s+   - -  



        ' ' ' ' ' ' ' ' 'h''))0t$H$J77788
 h/ / /# # #
 
 
$ $ $0 0 00 0 04 4 40 0 0* * * * *r   