U
    ZÊ¹jÂ  ã                   @   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   úg/var/www/html/bwave/python/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   