o
    Zh                     @   s   d Z ddlZddlZddlZddlmZ ddlm  mZ	 ee
 jZeejddZejZdd Zdd	 Zd
d Zdd Zdd Zdd Zdd Zdd Zdd ZdS )z'Tests for IPython.utils.module_paths.py    N)Pathzwith.dot)suffixc                 C   s   t | ddd  d S )Nwzutf-8)encoding)openclose)fname r	   \/var/www/html/lang_env/lib/python3.10/site-packages/IPython/utils/tests/test_module_paths.pymake_empty_file    s   r   c                   C   sh   t td jdd t td jdd ttd  ttd  ttd  ttd  ttgt_d	S )
z+Setup testenvironment for the module:

    xmodT)parentsZnomodzxmod/__init__.pyzxmod/sub.pypack.pyzpackpyc.pycN)r   TMP_TEST_DIRmkdirr   strsyspathr	   r	   r	   r
   setup_module$   s   r   c                   C   s   t t tt_dS )zZTeardown testenvironment for the module:

    - Remove tempdir
    - restore sys.path
    N)shutilrmtreer   old_syspathr   r   r	   r	   r	   r
   teardown_module2   s   
	
r   c                   C   s   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	   r
   test_tempdir>   s   r   c                  C   &   t d d } tt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modpathr	   r	   r
   test_find_mod_1E      r"   c                  C   r   )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    r	   r	   r
   test_find_mod_2M   s   r$   c                  C   s&   t d d } tt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    r	   r	   r
   test_find_mod_3V   r#   r%   c                  C   s"   t d } tt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    r	   r	   r
   test_find_mod_4^   s   r'   c                   C   s   t 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?
    ZpackpycN)r   r   r	   r	   r	   r
   test_find_mod_5f   s   r(   )__doc__r   r   tempfilepathlibr   ZIPython.utils.module_pathsutilsZmodule_pathsr   __file__resolveparentZTEST_FILE_PATHmkdtempr   r   r   r   r   r   r   r"   r$   r%   r'   r(   r	   r	   r	   r
   <module>   s$   	