o
    b                     @   s*   d Z ddlZddlZG dd dejZdS )z!
This script tests ``PathSpec``.
    Nc                   @   s`   e Zd Z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d Zdd ZdS )PathSpecTestz<
	The ``PathSpecTest`` class tests the ``PathSpec`` class.
	c                 C   s6   t jddg}t|g d}| |h d dS )H
		Tests that absolute paths will be properly normalized and matched.
		gitwildmatchZfooz/a.py	/foo/a.pyz/x/a.py/x/foo/a.pyza.pyfoo/a.pyzx/a.py
x/foo/a.py>   r   r   r	   r   NpathspecPathSpec
from_linessetmatch_filesassertEqualselfspecresults r   [/var/www/secure340b-portal/env/lib/python3.10/site-packages/pathspec/tests/test_pathspec.pytest_01_absolute_dir_paths_1   s
   
z)PathSpecTest.test_01_absolute_dir_paths_1c                 C   s6   t jddg}t|g d}| |ddh dS )r   r   z/foor   r   r   Nr
   r   r   r   r   test_01_absolute_dir_paths_2(   s   

z)PathSpecTest.test_01_absolute_dir_paths_2c                 C   s8   t jdddg}t|g d}| |h d dS )c
		Tests that paths referencing the current directory will be properly
		normalized and matched.
		r   *.txt!test1/)z./src/test1/a.txtz./src/test1/b.txtz./src/test1/c/c.txt./src/test2/a.txt./src/test2/b.txt./src/test2/c/c.txt>   r   r   r   Nr
   r   r   r   r   test_01_current_dir_paths>   s   z&PathSpecTest.test_01_current_dir_pathsc                 C   sH   t jdddg}g d}tt|j|}t||}| || dS )zl
		Tests that matching files one at a time yields the same results as
		matching multiples files at once.
		r   r   r   )zsrc/test1/a.txtzsrc/test1/b.txtzsrc/test1/c/c.txtzsrc/test2/a.txtzsrc/test2/b.txtzsrc/test2/c/c.txtN)r   r   r   r   filterZ
match_filer   r   )r   r   Z
test_filesZsingle_resultsZmulti_resultsr   r   r   test_01_match_filesU   s   z PathSpecTest.test_01_match_filesc                 C   <   t jdddg}t|jg ddd}| |h d dS )	r   r   r   r   )z.\src\test1\a.txtz.\src\test1\b.txtz.\src\test1\c\c.txt.\src\test2\a.txt.\src\test2\b.txt.\src\test2\c\c.txt\
separators>   r#   r$   r%   Nr
   r   r   r   r   !test_01_windows_current_dir_pathsj   s   z.PathSpecTest.test_01_windows_current_dir_pathsc                 C   r"   )	zG
		Tests that Windows paths will be properly normalized and matched.
		r   r   r   )zsrc\test1\a.txtzsrc\test1\b.txtzsrc\test1\c\c.txtsrc\test2\a.txtsrc\test2\b.txtsrc\test2\c\c.txtr&   r(   >   r+   r,   r-   Nr
   r   r   r   r   test_01_windows_paths   s   z"PathSpecTest.test_01_windows_pathsc                 C   s4   t jdddg}t jdddg}| || dS )
		Tests equality.
		r   r   r   N)r   r   r   r   r   
first_specsecond_specr   r   r   
test_02_eq   s   zPathSpecTest.test_02_eqc                 C   s0   t jddg}t jddg}| || dS )r/   r   r   z!*.txtN)r   r   r   ZassertNotEqualr0   r   r   r   
test_02_ne   s   zPathSpecTest.test_02_nec                 C   sV   t jdddg}t jdddg}|| }t|jg ddd}| |h d	 d
S )z,
		Test pattern addition using + operator
		r   test.txttest.png	test.htmltest.jpgr5   r6   r7   r8   r&   r(      r8   r6   r5   r7   Nr
   )r   r1   r2   Zcombined_specr   r   r   r   test_01_addition   s   zPathSpecTest.test_01_additionc                 C   sR   t jdddg}|t jdddg7 }t|jg ddd}| |h d	 d
S )z-
		Test pattern addition using += operator
		r   r5   r6   r7   r8   r9   r&   r(   r:   Nr
   r   r   r   r   test_02_addition   s   
zPathSpecTest.test_02_additionN)__name__
__module____qualname____doc__r   r   r   r!   r*   r.   r3   r4   r;   r<   r   r   r   r   r      s    r   )r@   Zunittestr   ZTestCaser   r   r   r   r   <module>   s   