a
    ø£Beô
  ã                   @   s‚  d dl Z d dlZd dlZd dlZddlmZmZ e ¡ dkZe  	d¡ 
¡ Zejdd… dkZejjedd�ej d	de ¡ gg¡d
d„ ƒƒZejjedd�ejjedd�ej d	eed ƒed  ¡ gg¡dd„ ƒƒƒZejje dd�ej d	ddgddgddgg¡dd„ ƒƒZejjedd�ej dddgddgddgg¡dd „ ƒƒZejje dd�ej d!dd"gdd#gg¡d$d%„ ƒƒZdS )&é    Né   )Úfile_uri_to_pathÚnormalized_uriÚWindowsú~)é   é   z!can't test POSIX paths on Windows)Úreasonzroot_dir, expected_root_uric                 C   s   t | ƒ|ksJ ‚d S ©N©r   ©Úroot_dirÚexpected_root_uri© r   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jupyter_lsp/tests/test_paths.pyÚtest_normalize_posix_path_home   s    r   z%can't test non-existent paths on py35Zfooc                 C   s   t | ƒ|ksJ ‚d S r
   r   r   r   r   r   Ú%test_normalize_posix_path_home_subdir   s    r   z!can't test Windows paths on POSIXzc:\Users\user1zfile:///c:/Users/user1zC:\Users\user1z//VBOXSVR/shared-folderzfile://vboxsvr/shared-folder/c              
   C   s^   zt | ƒ}W n@ tyL } z(tjdkr4W Y d }~d S |‚W Y d }~n
d }~0 0 ||ksZJ ‚d S )N)r   é
   )r   ÚFileNotFoundErrorÚsysÚversion_info)r   r   Ú
normalizedÚerrr   r   r   Ú test_normalize_windows_path_case#   s    
r   zfile_uri, expected_posix_pathz'file:///C:/Windows/System32/Drivers/etcz /C:/Windows/System32/Drivers/etcz%file:///C:/some%20dir/some%20file.txtz/C:/some dir/some file.txtz!file:///home/user/some%20file.txtz/home/user/some file.txtc                 C   s   t | ƒ|ksJ ‚d S r
   ©r   )Úfile_uriZexpected_posix_pathr   r   r   Útest_file_uri_to_path_posix9   s    
r   zfile_uri, expected_windows_pathzC:/Windows/System32/Drivers/etczC:/some dir/some file.txtc                 C   s   t | ƒ|ksJ ‚d S r
   r   )r   Zexpected_windows_pathr   r   r   Útest_file_uri_to_path_windowsF   s    
r   )ÚpathlibÚplatformr   ZpytestÚpathsr   r   ÚsystemZWINÚPathÚ
expanduserÚHOMEr   ZPY35ÚmarkZskipifZparametrizeÚas_urir   Ústrr   r   r   r   r   r   r   r   Ú<module>   sX   þþýþýþýþ