
    i<q                        d Z ddlZddlZddlmZmZ ej                  j                  dg d      de	de	ddfd	       Z
ej                  j                  d
g d      de	de	de	deddf
d       Zej                  j                  dg d      de	dej                  e	   dej                  e	   dededdfd       Zd>dZej                  j                  dg d      de	dedej                  e	   dej                  e	   ddf
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ej                  j                  d%d&d'gfd(d)gfd*d+gfd,d-gfd.d/gfd0d-d1gfd2d/d3gfd4d/d3gfg      d5ej4                  ej6                  ej                  e	   e	f      ddfd6       Zej                  j                  d7g d8      de	d9ej                  e	   d:ej                  e	   ddfd;       Zej                  j                  dg d<      de	de	ddfd=       Zy)?z,Tests for numpydoc-style docstring routines.    Ncomposeparsezsource, expected)) N)
NShort descriptionr	   z
Short description
r	   z
   Short description
r	   sourceexpectedreturnc                 t    t        |       }|j                  |k(  sJ |j                  J |j                  rJ y)zTest parsing short description.N)r   short_descriptionlong_descriptionmeta)r   r   	docstrings      SC:\Projects\mas-dev\.venv\Lib\site-packages\docstring_parser/tests/test_numpydoc.pytest_short_descriptionr   	   sB     fI&&(222%%---~~~    z?source, expected_short_desc, expected_long_desc, expected_blank))#Short description

Long descriptionr	   Long descriptionT)I
            Short description

            Long description
            r	   r   T)a
            Short description

            Long description
            Second line
            r	   Long description
Second lineT)"Short description
Long descriptionr	   r   F)H
            Short description
            Long description
            r	   r   F)$
Short description
Long description
r	   r   F)`
            Short description
            Long description
            Second line
            r	   r   Fexpected_short_descexpected_long_descexpected_blankc                     t        |       }|j                  |k(  sJ |j                  |k(  sJ |j                  |k(  sJ |j                  rJ y)zTest parsing long description.N)r   r   r   blank_after_short_descriptionr   )r   r    r!   r"   r   s        r   test_long_descriptionr%      s[    L fI&&*====%%);;;;22nDDD~~~r   zdsource, expected_short_desc, expected_long_desc, expected_blank_short_desc, expected_blank_long_desc))zi
            Short description
            Parameters
            ----------
            asd
            r	   NFF)z
            Short description
            Long description
            Parameters
            ----------
            asd
            r	   r   FF)z
            Short description
            First line
                Second line
            Parameters
            ----------
            asd
            r	   First line
    Second lineFF)z
            Short description

            First line
                Second line
            Parameters
            ----------
            asd
            r	   r&   TF)z
            Short description

            First line
                Second line

            Parameters
            ----------
            asd
            r	   r&   TT)zK
            Parameters
            ----------
            asd
            NNFFexpected_blank_short_descexpected_blank_long_descc                     t        |       }|j                  |k(  sJ |j                  |k(  sJ |j                  |k(  sJ |j                  |k(  sJ t        |j                        dk(  sJ y)z2Test parsing newlines around description sections.   N)r   r   r   r$   blank_after_long_descriptionlenr   )r   r    r!   r'   r(   r   s         r   test_meta_newlinesr-   h   sy    ~ fI&&*====%%);;;;226OOOO115MMMMy~~!###r   c                  (   t        d      } | j                  dk(  sJ t        | j                        dk(  sJ | j                  d   j                  ddgk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  dk(  sJ y)	z*Test parsing multiline meta documentation.z
        Short description

        Parameters
        ----------
        spam
            asd
            1
                2
            3
        r	   r*   r   paramspamasd
1
    2
3N)r   r   r,   r   argsarg_namedescriptionr   s    r   $test_meta_with_multiline_descriptionr6      s    
	I &&*====y~~!###>>!!!gv%6666>>!%%///>>!((,>>>>r   zBsource, expected_is_optional, expected_type_name, expected_default))z
                Parameters
                ----------
                arg1 : int
                    The first arg
                FintN)z
                Parameters
                ----------
                arg2 : str
                    The second arg
                FstrN)z
                Parameters
                ----------
                arg3 : float, optional
                    The third arg. Default is 1.0.
                Tfloatz1.0)z
                Parameters
                ----------
                arg4 : Optional[Dict[str, Any]], optional
                    The fourth arg. Defaults to None
                TzOptional[Dict[str, Any]]None)z
                Parameters
                ----------
                arg5 : str, optional
                    The fifth arg. Default: DEFAULT_ARGS
                Tr8   DEFAULT_ARGS)z
                Parameters
                ----------
                parameter_without_default : int
                    The parameter_without_default is required.
                Fr7   Nexpected_is_optionalexpected_type_nameexpected_defaultc                     t        |       }|J t        |j                        dk(  sJ |j                  d   }|j                  |k(  sJ |j                  |k(  sJ |j
                  |k(  sJ y)zTest parsing default arguments.Nr*   r   )r   r,   paramsis_optional	type_namedefault)r   r<   r=   r>   r   arg1s         r   test_default_argsrE      s~    \ fI   y A%%%AD3333>>////<<++++r   c                     t        d      } | j                  dk(  sJ t        | j                        dk(  sJ | j                  d   j                  ddgk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  d	d
gk(  sJ | j                  d   j                  d
k(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  d	dgk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ y)zTest parsing multiple meta.z
        Short description

        Parameters
        ----------
        spam
            asd
            1
                2
            3

        Raises
        ------
        bla
            herp
        yay
            derp
        r	      r   r/   r0   r1   r*   raisesblaherp   yayderpN)r   r   r,   r   r2   r3   r4   rB   r5   s    r   test_multiple_metarN   =  sT   	I( &&*====y~~!###>>!!!gv%6666>>!%%///>>!((,>>>>>>!!!h%6666>>!&&%///>>!((F222>>!!!h%6666>>!&&%///>>!((F222r   c                     t        d      } t        | j                        dk(  sJ t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  J | j                  d   j
                  dk(  sJ | j                  d   j                  rJ | j                  d   j                  d	k(  sJ | j                  d   j                  d
k(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  rJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  sJ t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  J | j                  d   j
                  dk(  sJ | j                  d   j                  d	k(  sJ | j                  d   j                  d
k(  sJ | j                  d   j
                  dk(  sJ y)zTest parsing params.r	   r   a  
        Short description

        Parameters
        ----------
        name
            description 1
        priority : int
            description 2
        sender : str, optional
            description 3
        ratio : Optional[float], optional
            description 4
           nameNdescription 1r*   priorityr7   description 2rK   senderr8   description 3rG   ratioOptional[float]description 4z
        Short description

        Parameters
        ----------
        name
            description 1
            with multi-line text
        priority : int
            description 2
        "description 1
with multi-line textr   r,   r@   r3   rB   r4   rA   r5   s    r   test_paramsr\   `     )*Iy A%%%	I  y A%%%A''6111A((000A**o==="....A'':555A((E111A**o==="....A''8333A((E111A**o===A****A''7222A((,====A**o===A****
	I y A%%%A''6111A((000A**-   A'':555A((E111A**o===r   c                     t        d      } t        | j                        dk(  sJ t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  J | j                  d   j
                  dk(  sJ | j                  d   j                  rJ | j                  d   j                  d	k(  sJ | j                  d   j                  d
k(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  rJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  sJ t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  J | j                  d   j
                  dk(  sJ | j                  d   j                  d	k(  sJ | j                  d   j                  d
k(  sJ | j                  d   j
                  dk(  sJ y)zTest parsing attributes.r	   r   a  
        Short description

        Attributes
        ----------
        name
            description 1
        priority : int
            description 2
        sender : str, optional
            description 3
        ratio : Optional[float], optional
            description 4
        rP   rQ   NrR   r*   rS   r7   rT   rK   rU   r8   rV   rG   rW   rX   rY   z
        Short description

        Attributes
        ----------
        name
            description 1
            with multi-line text
        priority : int
            description 2
        rZ   r[   r5   s    r   test_attributesr_     r]   r   c                     t        d      } t        | j                        dk(  sJ | j                  d   j                  ddgk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dd	gk(  sJ y
)zTest parsing other parameters.z
        Short description
        Other Parameters
        ----------------
        only_seldom_used_keywords : type, optional
            Explanation
        common_parameters_listed_above : type, optional
            Explanation
        rK   r   other_paramonly_seldom_used_keywordstypeExplanationr*   common_parameters_listed_aboveN)r   r,   r   r2   r3   rB   rA   r4   r5   s    r   test_other_paramsrf     s    	
I y~~!###>>!!!#&    >>!%%)DDDD>>!&&&000>>!((((>>!((M999>>!!!(&   r   c                  p   t        d      } t        | j                        dk(  sJ | j                  d   j                  dgk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  J | j                  d   j                  sJ y)zTest parsing yields.ze
        Short description
        Yields
        ------
        int
            description
        r*   r   yieldsr7   r4   N)r   r,   r   r2   rB   r4   return_nameis_generatorr5   s    r   test_yieldsrk     s    	I y~~!###>>!!!hZ///>>!&&%///>>!((M999>>!((000>>!))))r   c                  ~   t        d      } | j                  J | j                  J t        | j                        dk(  sJ t        d      } | j                  J | j                  j                  dk(  sJ | j                  j
                  J | j                  J t        | j                        dk(  sJ | j                  d   | j                  k(  sJ t        d      } | j                  J | j                  j                  dk(  sJ | j                  j
                  d	k(  sJ | j                  J t        | j                        dk(  sJ | j                  d   | j                  k(  sJ t        d
      } | j                  J | j                  j                  dk(  sJ | j                  j
                  dk(  sJ | j                  J t        | j                        dk(  sJ | j                  d   | j                  k(  sJ t        d      } | j                  J | j                  j                  dk(  sJ | j                  j
                  dk(  sJ | j                  J t        | j                        dk(  sJ | j                  d   | j                  k(  sJ t        d      } | j                  J | j                  j                  dk(  sJ | j                  j
                  dk(  sJ | j                  J t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j
                  dk(  sJ | j                  d   j                  dk(  sJ y)zTest parsing returns.#
        Short description
        Nr   zP
        Short description
        Returns
        -------
        type
        rc   r*   zg
        Short description
        Returns
        -------
        int
            description
        r7   r4   z{
        Returns
        -------
        Optional[Mapping[str, List[int]]]
            A description: with a colon
        z!Optional[Mapping[str, List[int]]]zA description: with a colonz
        Short description
        Returns
        -------
        int
            description
            with much text

            even some spacing
        z-description
with much text

even some spacingz
        Short description
        Returns
        -------
        a : int
            description for a
        b : str
            description for b
        zdescription for arK   ar8   zdescription for bb)r   returnsmany_returnsr,   rB   r4   ri   r5   s    r   test_returnsrr     s   	I
 $$$!!---y%%&!+++	I (((&&&000((000!!---y%%&!+++!!!$	(9(9999	I (((&&%///((M999!!---y%%&!+++!!!$	(9(9999	I (((&&*MMMM((,IIII!!---y%%&!+++!!!$	(9(9999		I (((&&%///((:   !!---y%%&!+++!!!$	(9(9999	
I (((&&%///((-@AAA!!---y%%&!+++!!!$..%777!!!$004GGGG!!!$00C777!!!$..%777!!!$004GGGG!!!$00C777r   c                     t        d      } t        | j                        dk(  sJ t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ y)zTest parsing raises.rm   r   zl
        Short description
        Raises
        ------
        ValueError
            description
        r*   
ValueErrorr4   N)r   r,   rH   rB   r4   r5   s    r   test_raisesru   t  s    	I
 y A%%%	I y A%%%A((L888A**m;;;r   c                      t        d      } t        | j                        dk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dk(  sJ y)zTest parsing warns.zk
        Short description
        Warns
        -----
        UserWarning
            description
        r*   r   UserWarningr4   N)r   r,   r   rB   r4   r5   s    r   
test_warnsrx     sd    	I y~~!###>>!&&-777>>!((M999r   c                     t        d      } t        | j                        dk(  sJ | j                  d   j                  dgk(  sJ | j                  d   j                  dk(  sJ | j                  d   j                  dgk(  sJ | j                  d   j                  dk(  sJ | j                  d	   j                  d
gk(  sJ | j                  d	   j                  dk(  sJ | j                  d   j                  dgk(  sJ y)zTest parsing simple sections.a  
        Short description

        See Also
        --------
        something : some thing you can also see
        actually, anything can go in this section

        Warnings
        --------
        Here be dragons

        Notes
        -----
        None of this is real

        References
        ----------
        Cite the relevant literature, e.g. [1]_.  You may also cite these
        references in the notes section above.

        .. [1] O. McNoleg, "The integration of GIS, remote sensing,
           expert systems and adaptive co-kriging for environmental habitat
           modelling of the Highland Haggis using object-oriented, fuzzy-logic
           and neural-network techniques," Computers & Geosciences, vol. 22,
           pp. 585-588, 1996.
        rP   r   see_alsozQsomething : some thing you can also see
actually, anything can go in this sectionr*   warningszHere be dragonsrK   noteszNone of this is realrG   
referencesN)r   r,   r   r2   r4   r5   s    r   test_simple_sectionsr~     s
   	I: y~~!###>>!!!j\111>>!((	4  
 >>!!!j\111>>!((,====>>!!!gY...>>!((,BBBB>>!!!l^333r   zsource, expected_resultsz5Description
Examples
--------
long example

more here)Nzlong example

more herez&Description
Examples
--------
>>> test)z>>> testr   z1Description
Examples
--------
>>> testa
>>> testb)z>>> testa
>>> testbr   z-Description
Examples
--------
>>> test1
desc1)z	>>> test1desc1zADescription
Examples
--------
>>> test1a
>>> test1b
desc1a
desc1b)z>>> test1a
>>> test1bzdesc1a
desc1bz=Description
Examples
--------
>>> test1
desc1
>>> test2
desc2)z	>>> test2desc2zfDescription
Examples
--------
>>> test1a
>>> test1b
desc1a
desc1b
>>> test2a
>>> test2b
desc2a
desc2b
)z>>> test2a
>>> test2bzdesc2a
desc2bzDescription
Examples
--------
    >>> test1a
    >>> test1b
    desc1a
    desc1b
    >>> test2a
    >>> test2b
    desc2a
    desc2b
expected_resultsc                    t        |       }t        |j                        t        |      k(  sJ t        |j                  |      D ]  \  }}|j                  |d   k(  rJ  t        |j
                        t        |      k(  sJ t        |j
                  |      D ]-  \  }}|j                  |d   k(  sJ |j                  |d   k(  r-J  y)zTest parsing examples.r*   r   N)r   r,   r   zipr4   examplessnippet)r   r   r   r   expected_resultexamples         r   test_examplesr     s    D fIy~~#&6"7777!$Y^^5E!Fo?1#5555 "Gy!!"c*:&;;;;$'	(:(:<L$M /!"4444""oa&8888 %Nr   z1source, expected_depr_version, expected_depr_desc))z<Short description

.. deprecated:: 1.6.0
    This is busted!1.6.0zThis is busted!)zUShort description

.. deprecated:: 1.6.0
    This description has
    multiple lines!r   z$This description has
multiple lines!)z(Short description

.. deprecated:: 1.6.0r   N)z2Short description

.. deprecated::
    No version!NzNo version!expected_depr_versionexpected_depr_descc                     t        |       }|j                  J |j                  j                  |k(  sJ |j                  j                  |k(  sJ y)zTest parsing deprecation notes.N)r   deprecationversionr4   )r   r   r   r   s       r   test_deprecationr     sV    @ fI  ,,,  ((,AAAA  ,,0BBBBr   ))r   r   )r   r   r   r
   r   )r   r   )r   r   )r   z/Short description

Long description
Second line)r   r   )r   r   )r   r   )r   z.Short description
Long description
Second line)zc
            Short description
            Meta:
            -----
                asd
            z%Short description
Meta:
-----
    asd)z
            Short description
            Long description
            Meta:
            -----
                asd
            z6Short description
Long description
Meta:
-----
    asd)z
            Short description
            First line
                Second line
            Meta:
            -----
                asd
            z@Short description
First line
    Second line
Meta:
-----
    asd)z
            Short description

            First line
                Second line
            Meta:
            -----
                asd
            zAShort description

First line
    Second line
Meta:
-----
    asd)z
            Short description

            First line
                Second line

            Meta:
            -----
                asd
            zBShort description

First line
    Second line

Meta:
-----
    asd)z
            Short description

            Meta:
            -----
                asd
                    1
                        2
                    3
            zHShort description

Meta:
-----
    asd
        1
            2
        3)a  
            Short description

            Meta1:
            ------
                asd
                1
                    2
                3
            Meta2:
            ------
                herp
            Meta3:
            ------
                derp
            zlShort description

Meta1:
------
    asd
    1
        2
    3
Meta2:
------
    herp
Meta3:
------
    derp)a  
            Short description

            Parameters:
            -----------
                name
                    description 1
                priority: int
                    description 2
                sender: str, optional
                    description 3
                message: str, optional
                    description 4, defaults to 'hello'
                multiline: str, optional
                    long description 5,
                        defaults to 'bye'
            a>  Short description

Parameters:
-----------
    name
        description 1
    priority: int
        description 2
    sender: str, optional
        description 3
    message: str, optional
        description 4, defaults to 'hello'
    multiline: str, optional
        long description 5,
            defaults to 'bye')z
            Short description
            Raises:
            -------
                ValueError
                    description
            zDShort description
Raises:
-------
    ValueError
        description)z
            Description
            Examples:
            --------
            >>> test1a
            >>> test1b
            desc1a
            desc1b
            >>> test2a
            >>> test2b
            desc2a
            desc2b
            zfDescription
Examples:
--------
>>> test1a
>>> test1b
desc1a
desc1b
>>> test2a
>>> test2b
desc2a
desc2bc                 6    t        t        |             |k(  sJ y)zTest compose in default mode.Nr   )r   r   s     r   test_composer   =  s    F 5=!X---r   )r   N)__doc__typingTpytestdocstring_parser.numpydocr   r   markparametrizer8   r   boolr%   Optionalr-   r6   rE   rN   r\   r_   rf   rk   rr   ru   rx   r~   ListTupler   r   r    r   r   <module>r      s}   2   4 	3 # $ 	 E;>~  	
 
>~ :RVn$$C$ 

3$  $	$
 #$ 
$oVn$ ?, HCFN,,, 

3, jjo	,
 
,OFN," 3F<>~<>~:*&c8L<.: ,4^  I3	
 8 	
 D,	
 @&	
5 =	
1 '&	
7 =<		
G =<		
c:=|9ffQWWQZZ_c-A%BC9	9}=|9 74
C
C::c?
C 

3
C 
	
C54
C }@B. . . .C@B.r   