o
    .jB
                     @   s   d Z ddlZddlZddlZddlmZ ddlZeepd j	Z
e
d Zdd edD Zd	d eD ZdddZejdeded
dfddZe
j	j	j	ZeedZejdddgded
dfddZejdedd ZdddZdS )zThis file tests the source code provided by the documentation.

See
- doctest documentation: https://docs.python.org/3/library/doctest.html
- :issue:`443`

This file should be tests, too:

    >>> print("Hello World!")
    Hello World!

    N)Path.z..c                 C   s    g | ]}d | tjvr|qS )fuzzing)relative_toICALENDAR_PATHparts).0file r
   V/home/thesage/.local/lib/python3.10/site-packages/icalendar/tests/test_with_doctest.py
<listcomp>   s
    r   z**/*.pyc                 C   s8   g | ]}d t |tt td dddd qS )	icalendar\/r   )strlenr   replace)r   python_filer
   r
   r   r      s    returnc                   C   s   t tv sJ d S N)__name__MODULE_NAMESr
   r
   r
   r   test_this_module_is_among_them'   s   r   module_namec              
   C   sp   zt | }W n ty } z|jdkrtd  d}~ww tj|| |d}|jdks6J |j d|  dS )z,This test runs doctest on the Python module.pytzz,pytz is not installed, skipping this module.N)nameglobsr    errors in )		importlibimport_moduleModuleNotFoundErrorr   pytestskipdoctesttestmodfailed)r   env_for_doctestmoduleetest_resultr
   r
   r   test_docstring_of_python_file+   s   

"r+   z**/*.rstfilenamez
README.rstz	index.rstc                    s   t  fddtD sJ d S )Nc                 3   s    | ]}|j  kV  qd S r   )r   )r   pathr,   r
   r   	<genexpr>E   s    z)test_files_is_included.<locals>.<genexpr>)anyDOCUMENT_PATHSr.   r
   r.   r   test_files_is_included=   s   r2   documentc                 C   s|   zddl }W n ty   td Y nw ztj| d|dd}W |  n|  w |jdks<J |j dt| j	 dS )z^This test runs doctest on a documentation file.

    functions are also replaced to work.
    r   Nz'pytz not installed, skipping this file.F)module_relativer   raise_on_errorr   )
r   ImportErrorr"   r#   r$   testfileuse_zoneinfor&   r   r   )r3   zoneinfo_onlyr'   tzpr   r*   r
   r
   r   test_documentation_fileH   s   r;   c                 C   s   dt jv sJ dS )z#Allow importing zoneinfo for tests.zoneinfoN)sysmodules)r'   r
   r
   r   test_can_import_zoneinfo^   s   r?   )r   N)__doc__r$   r   r=   pathlibr   r"   __file__absoluteparentHEREr   globPYTHON_FILESr   r   markparametrizer   r+   
REPOSITORYlistr1   r2   r;   r?   r
   r
   r
   r   <module>   s:    
	

