Format: application/x-python-code
⬇ Download File (2.9 KB)
   1  o
   2  
   3  ��h��@s�dZddlZddlZddlZddlmZddlmmZ	ee
   4  ���jZ
   5  eejdd��ZejZdd�Zdd	�Zd
   6  d�Zdd
   7  �Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)z'Tests for IPython.utils.module_paths.py�N)�Pathzwith.dot)�suffixcCst|ddd���dS)N�wzutf-8)�encoding)�open�close)�fname�r	�[c:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/utils/tests/test_module_paths.py�make_empty_file srcCshttd�jdd�ttd�jdd�ttd�ttd�ttd�ttd�tt�gt_d	S)
   8  z+Setup testenvironment for the module:
   9  
  10      �xmodT)�parentsZnomodzxmod/__init__.pyzxmod/sub.py�pack.pyzpackpyc.pycN)r�TMP_TEST_DIR�mkdirr�str�sys�pathr	r	r	r
  11  �setup_module$srcCst�t�tt_dS)zZTeardown testenvironment for the module:
  12  
  13      - Remove tempdir
  14      - restore sys.path
  15      N)�shutil�rmtreer�old_syspathrrr	r	r	r
  16  �teardown_module2s
  17  	
  18  rcCsdtt�vsJ�dS)zS
  19      Ensure the test are done with a temporary file that have a dot somewhere.
  20      �.N)rrr	r	r	r
  21  �test_tempdir>srcC�&tdd}tt�d��|ksJ�dS)zo
  22      Search for a directory's file path.
  23      Expected output: a path to that directory's __init__.py file.
  24      r�__init__.pyN�rr�mp�find_mod��modpathr	r	r
  25  �test_find_mod_1E�r"cCr)z�
  26      Search for a directory's file path.
  27      Expected output: a path to that directory's __init__.py file.
  28      TODO: Confirm why this is a duplicate test.
  29      rrNrr r	r	r
  30  �test_find_mod_2Msr$cCs&tdd}tt�d��|ksJ�dS)zz
  31      Search for a directory + a filename without its .py extension
  32      Expected output: full path with .py extension.
  33      rzsub.pyzxmod.subNrr r	r	r
  34  �test_find_mod_3Vr#r%cCs"td}tt�d��|ksJ�dS)zk
  35      Search for a filename without its .py extension
  36      Expected output: full path with .py extension
  37      r�packNrr r	r	r
  38  �test_find_mod_4^sr'cCst�d�dks	J�dS)zu
  39      Search for a filename with a .pyc extension
  40      Expected output: TODO: do we exclude or include .pyc files?
  41      ZpackpycN)rrr	r	r	r
  42  �test_find_mod_5fsr()�__doc__rr�tempfile�pathlibrZIPython.utils.module_paths�utilsZmodule_pathsr�__file__�resolve�parentZTEST_FILE_PATH�mkdtemprrrrrrrr"r$r%r'r(r	r	r	r
  43  �<module>s$
  44