U
    L?h                     @   s\   d dl Z d dlmZ d dlZd dlmZmZmZmZ dd Z	G dd dZ
G dd	 d	ZdS )
    N)List)make_absolute_path	sympy_dirupdate_args_with_pathsupdate_args_with_rootdirc                  C   s,   t g } | dtttjd gks(tdS )z>`--rootdir` and directory three above this added as arguments.z	--rootdir   N)r   strpathlibPath__file__parentsAssertionError)args r   Z/var/www/html/venv/lib/python3.8/site-packages/sympy/testing/tests/test_runtests_pytest.pytest_update_args_with_rootdir   s    r   c                   @   sV   e Zd ZeejddddgedddZeejddd	gedd
dZ	dS )TestMakeAbsolutePathpartial_pathsympy
sympy/corezsympy/nonexistant_directory)r   c                 C   s   t | }dS )z(Paths that start with `sympy` are valid.N)r   r   _r   r   r   test_valid_partial_path   s    z,TestMakeAbsolutePath.test_valid_partial_pathZ	not_sympyzalso/not/sympyc              	   C   s"   t t t| }W 5 Q R X dS )z@A `ValueError` is raises on paths that don't start with `sympy`.N)pytestZraises
ValueErrorr   r   r   r   r   ,test_invalid_partial_path_raises_value_error   s    zATestMakeAbsolutePath.test_invalid_partial_path_raises_value_errorN)
__name__
__module____qualname__staticmethodr   markparametrizer   r   r   r   r   r   r   r      s     r   c                
   @   s  e Zd Zedd ZeejdddgedddZ	ed	d
 Z
edd Zeejdddgdddddgfgee ee dddZeejdg dgdgdgdggee dddZeejdg dgd gd!ggee dd"d#Zed$d% Zed&d' Zd(S ))TestUpdateArgsWithPathsc                  C   sF   g } t | dg d}ttt dttt dg}||ksBtdS )a3  If no paths are passed, only `sympy` and `doc/src` are appended.

        `sympy` and `doc/src` are the `testpaths` stated in `pytest.ini`. They
        need to be manually added as if any path-related arguments are passed
        to `pytest.main` then the settings in `pytest.ini` may be ignored.

        Npathskeywordsr   r   zdoc/srcr   r   r	   r
   r   r   r$   r   expectedr   r   r   test_no_paths*   s    	z%TestUpdateArgsWithPaths.test_no_pathspathsympy/core/tests/test_basic.pyZ_basic)r*   c                 C   s4   t | gdg d}ttt dg}||ks0tdS )z;Single files/paths, full or partial, are matched correctly.Nr#   r+   r&   )r*   r   r(   r   r   r   test_one_file;   s    z%TestUpdateArgsWithPaths.test_one_filec                  C   s4   t dgdg d} ttt dg}| |ks0tdS )z;Partial paths from the root directly are matched correctly.sympy/functionsNr#   r&   )r   r(   r   r   r   test_partial_path_from_rootH   s    z3TestUpdateArgsWithPaths.test_partial_path_from_rootc                  C   sJ   ddg} t | dg d}ttt dttt dg}||ksFtdS )z7Multiple paths, partial or full, are matched correctly.r+   r-   Nr#   r&   r'   r   r   r   test_multiple_paths_from_rootO   s    z5TestUpdateArgsWithPaths.test_multiple_paths_from_rootzpaths, expected_pathsz/corez/utilzdoc/src/modules/utilitiesz"doc/src/reference/public/utilitiesr   zsympy/logic/utilitieszsympy/utilities)r$   expected_pathsc                 C   sJ   t | dg d}t|t|ks"ttt||D ]\}}||ks0tq0dS )z-Multiple partial paths are matched correctly.Nr#   r   lenr   zipsorted)r$   r0   r   argr(   r   r   r   !test_multiple_paths_from_non_rootZ   s    z9TestUpdateArgsWithPaths.test_multiple_paths_from_non_rootr$   zsympy/physicszsympy/physics/mechanicszsympy/physics/mechanics/testsz+sympy/physics/mechanics/tests/test_kane3.py)r$   c                 C   sT   d}t | |g d}dg}t|t|ks,ttt||D ]\}}||ks:tq:dS )z&String keywords are matched correctly.)bicycler#   9sympy/physics/mechanics/tests/test_kane3.py::test_bicycleNr1   r$   r%   r   expected_argsr5   r(   r   r   r   test_string_as_keywordq   s    z.TestUpdateArgsWithPaths.test_string_as_keywordzsympy/core/testsz sympy/core/tests/test_sympify.pyc                 C   sT   d}t | |g d}dg}t|t|ks,ttt||D ]\}}||ks:tq:dS )z'Integer keywords are matched correctly.)3538r#   1sympy/core/tests/test_sympify.py::test_issue_3538Nr1   r9   r   r   r   test_integer_as_keyword   s    z/TestUpdateArgsWithPaths.test_integer_as_keywordc                  C   sV   d} t g | g d}ddg}t|t|ks.ttt||D ]\}}||ks<tq<dS )z(Multiple keywords are matched correctly.)r7   r<   r#   r=   r8   Nr1   r%   r   r:   r5   r(   r   r   r   test_multiple_keywords   s    z.TestUpdateArgsWithPaths.test_multiple_keywordsc                  C   sV   d} t g | g d}ddg}t|t|ks.ttt||D ]\}}||ks<tq<dS )z+Keywords are matched across multiple files.)Z1130r#   zJsympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130zHsympy/utilities/tests/test_lambdify.py::test_python_div_zero_issue_11306Nr1   r?   r   r   r   $test_keyword_match_in_multiple_files   s    z<TestUpdateArgsWithPaths.test_keyword_match_in_multiple_filesN)r   r   r   r   r)   r   r    r!   r   r,   r.   r/   r   r6   r;   r>   r@   rA   r   r   r   r   r"   (   sf   



	
	
r"   )r	   typingr   r   Zsympy.testing.runtests_pytestr   r   r   r   r   r   r"   r   r   r   r   <module>   s   