
    f                     T   d Z ddlZddlZddlZddlZddlZddlZej                            e	          pdZ
ej                            e
          Zd  ej        e          D             Zd eD             Zd Zej                            de          d             Zej                            e
d	          Z	 d
 dD             Zn# e$ r  ed          w xY wej                            dddg          d             Zej                            de          d             Zd ZdS )a  This file tests the source code provided by the documentation.

See
- doctest documentation: https://docs.python.org/3/library/doctest.html
- Issue 443: https://github.com/collective/icalendar/issues/443

This file should be tests, too:

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

    N.c                     g | ]M\  }}}|D ]D}|                                                     d           rd|v-d                    ||f          ENS )z.pyfuzzing/)lowerendswithjoin).0dirpathdirnames	filenamesfilenames        e/var/www/dev/btcams2024/python_venv/lib/python3.11/site-packages/icalendar/tests/test_with_doctest.py
<listcomp>r      s}       $9  	!1!1!:!:5!A!A GPW^F^F^ HHgx !!F^F^F^F^    c                     g | ]I}d |t          t                    d                             dd                              dd          z   JS )	icalendar\r   r   )lenICALENDAR_PATHreplace)r
   python_files     r   r   r      sa        +c.11"45==dCHHPPQTVYZZZ  r   c                  &    t           t          v sJ d S N)__name__MODULE_NAMES r   r   test_this_module_is_among_themr   "   s    |######r   module_namec                     	 t          j        |           }n2# t          $ r%}|j        dk    rt	          j        d            d}~ww xY wt          j        ||           }|j        dk    sJ |j         d|              dS )z,This test runs doctest on the Python module.pytzz,pytz is not installed, skipping this module.N)namer    errors in )		importlibimport_moduleModuleNotFoundErrorr#   pytestskipdoctesttestmodfailed)r    moduleetest_results       r   test_docstring_of_python_filer0   %   s    (55   6VKFGGG /&{;;;K"""{'9$S$Sk$S$S"""""s    
A AAz	../../../c                    g | ]}t          j        t           j                            t          |                    D ]O}|                                                    d           )t           j                            t          ||          PS )z.rst)oslistdirpathr	   DOCUMENTATION_PATHr   r   )r
   subdirr   s      r   r   r   6   s       
27<<0BF#K#KLL  >>$$V,,	
'::   r   )docsr   zICould not find the documentation - remove the build folder and try again.r   z
README.rstz	index.rstc                 L     t           fdt          D                       sJ d S )Nc              3   B   K   | ]}|                               V  d S r   )r   )r
   r4   r   s     r   	<genexpr>z)test_files_is_included.<locals>.<genexpr>D   s/      BB4t}}X&&BBBBBBr   )anyDOCUMENT_PATHS)r   s   `r   test_files_is_includedr=   ?   s4    
 BBBB>BBBBBBBBBBr   documentc                    	 t          j        | d|d          }n[# t           j        $ rI}|j        \  }}}t	          |t
                    r|j        dk    rt          j        d           Y d}~nd}~ww xY w|	                                 n# |	                                 w xY w|j
        dk    s1J |j
         dt          j                            |                        dS )	z^This test runs doctest on a documentation file.

    functions are also replaced to work.
    FT)module_relativeglobsraise_on_errorr"   z'pytz not installed, skipping this file.Nr   r$   )r*   testfileUnexpectedExceptionexc_info
issubclassr'   r#   r(   r)   use_zoneinfor,   r2   r4   basename)	r>   zoneinfo_onlyenv_for_doctesttzpr/   r.   tyerrtbs	            r   test_documentation_filerO   G   s    &xonrsss& C C CjCb-.. 	C38v3E3EKABBBC
 	"""{'9$b$bbgFVFVW_F`F`$b$b"""""s+    B A3?A.)B .A33B B!c                 &    dt           j        v sJ dS )z#Allow importing zoneinfo for tests.zoneinfoN)sysmodules)rJ   s    r   test_can_import_zoneinforT   Y   s    $$$$$$r   )__doc__r*   r2   r(   r%   rR   rer4   dirname__file__HEREr   walkPYTHON_FILESr   r   markparametrizer0   r	   r5   r<   FileNotFoundErrorOSErrorr=   rO   rT   r   r   r   <module>r`      s     				      



 					wx  'C&& (/(?(?   #  
$ $ $ 55	T 	T 65	T W\\$44 _ #  NN  _ _ _
']
^
^^_ &  C C	 C ^44c c 54c"% % % % %s   :C C