
    h[;                        S r SSKrSSKrSSKJrJr  SSKJrJ	r	  \R                  R                  S/ SQ5      S\S\S	S4S
 j5       r\R                  R                  S/ SQ5      S\S\S\S\S	S4
S j5       r\R                  R                  S/ SQ5      S\S\R                   \   S\R                   \   S\S\S\R                   \   S	S4S j5       rS&S jrS&S jrS&S jrS&S jrS&S jrS&S jrS&S jrS&S jrS&S jr\R                  R                  S \R6                  S!4\R8                  S!4\R:                  S"4/5      S#\S\S	S4S$ j5       rS&S% jrg)'z(Tests for ReST-style docstring routines.    N)
ParseErrorRenderingStyle)composeparsezsource, expected)) N)
N)Short descriptionr	   )z
Short description
r	   )z
   Short description
r	   sourceexpectedreturnc                     [        U 5      nUR                  U:X  d   eUR                  U:X  d   eUR                  b   eUR                  (       a   eg)zTest parsing short description.N)r   short_descriptiondescriptionlong_descriptionmeta)r
   r   	docstrings      Z/home/james-whalen/.local/lib/python3.13/site-packages/docstring_parser/tests/test_rest.pytest_short_descriptionr   
   sV     fI&&(222  H,,,%%---~~~    z?source, expected_short_desc, expected_long_desc, expected_blank))z#Short description

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

            Long description
            r	   r   T)za
            Short description

            Long description
            Second line
            r	   Long description
Second lineT)"Short description
Long descriptionr	   r   F)zH
            Short description
            Long description
            r	   r   F)z$
Short description
Long description
r	   r   F)z`
            Short description
            Long description
            Second line
            r	   r   Fexpected_short_descexpected_long_descexpected_blankc                     [        U 5      nUR                  U:X  d   eUR                  U:X  d   eUR                  U:X  d   eUR                  (       a   eg)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   zxsource, expected_short_desc, expected_long_desc, expected_blank_short_desc, expected_blank_long_desc, expected_full_desc))zB
            Short description
            :meta: asd
            r	   NFFr	   )z_
            Short description
            Long description
            :meta: asd
            r	   r   FFr   )zu
            Short description
            First line
                Second line
            :meta: asd
            r	   First line
    Second lineFFz,Short description
First line
    Second line)zv
            Short description

            First line
                Second line
            :meta: asd
            r	   r   TF-Short description

First line
    Second line)zw
            Short description

            First line
                Second line

            :meta: asd
            r	   r   TTr    )z$
            :meta: asd
            NNFFNexpected_blank_short_descexpected_blank_long_descexpected_full_descc                    [        U 5      nUR                  U:X  d   eUR                  U:X  d   eUR                  U:X  d   eUR                  U:X  d   eUR
                  U:X  d   e[        UR                  5      S:X  d   eg)z2Test parsing newlines around description sections.   N)r   r   r   r   blank_after_long_descriptionr   lenr   )r
   r   r   r!   r"   r#   r   s          r   test_meta_newlinesr(   j   s    v fI&&*====%%);;;;226OOOO115MMMM  $6666y~~!###r   c                      [        S5      n U R                  S:X  d   e[        U R                  5      S:X  d   eU R                  S   R                  S/:X  d   eU R                  S   R
                  S:X  d   eg)z*Test parsing multiline meta documentation.ze
        Short description

        :meta: asd
            1
                2
            3
        r	   r%   r   r   asd
1
    2
3Nr   r   r'   r   argsr   r   s    r   $test_meta_with_multiline_descriptionr.      s|    		I &&*====y~~!###>>!!!fX--->>!((,>>>>r   c                     [        S5      n U R                  S:X  d   e[        U R                  5      S:X  d   eU R                  S   R                  S/:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  S/:X  d   eU R                  S   R
                  S	:X  d   eU R                  S
   R                  S/:X  d   eU R                  S
   R
                  S:X  d   eg)zTest parsing multiple meta.z
        Short description

        :meta1: asd
            1
                2
            3
        :meta2: herp
        :meta3: derp
        r	      r   meta1r*   r%   meta2herp   meta3derpNr+   r-   s    r   test_multiple_metar7      s    		I &&*====y~~!###>>!!!gY...>>!((,>>>>>>!!!gY...>>!((F222>>!!!gY...>>!((F222r   c                      [        S5      n U R                  S:X  d   e[        U R                  5      S:X  d   eU R                  S   R                  / SQ:X  d   eU R                  S   R
                  S:X  d   eg)z,Test parsing meta with additional arguments.zD
        Short description

        :meta ene due rabe: asd
        r	   r%   r   )r   eneduerabeasdNr+   r-   s    r   test_meta_with_argsr=      sz    	I &&*====y~~!###>>!!!%CCCC>>!((E111r   c                     [        S5      n [        U R                  5      S:X  d   e[        S5      n [        U R                  5      S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R                  b   eU R                  S   R
                  S:X  d   eU R                  S   R                  b   eU R                  S   R                  (       a   eU R                  S   R                  S	:X  d   eU R                  S   R                  S
:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  (       a   eU R                  S   R                  b   eU R                  S   R                  S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  (       d   eU R                  S   R                  b   eU R                  S   R                  S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  (       d   eU R                  S   R                  S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  (       d   eU R                  S   R                  S:X  d   e[        S5      n [        U R                  5      S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R                  S
:X  d   eU R                  S   R
                  S:X  d   eU R                  S   R                  b   eU R                  S   R                  (       a   eg)zTest parsing params.r	   r   a)  
        Short description

        :param name: description 1
        :param int priority: description 2
        :param str? sender: description 3
        :param str? message: description 4, defaults to 'hello'
        :param str? multiline: long description 5,
        defaults to 'bye'
           nameNzdescription 1r%   priorityintzdescription 2r4   senderstrzdescription 3r0   messagez"description 4, defaults to 'hello'z'hello'   	multilinez%long description 5,
defaults to 'bye'z'bye'z}
        Short description

        :param a: description a
        :type a: int
        :param int b: description b
        azdescription a)r   r'   paramsarg_name	type_namer   defaultis_optionalr-   s    r   test_paramsrN     s   )*Iy A%%%		I y A%%%A''6111A((000A**o===A&&..."....A'':555A((E111A**o==="....A&&...A''8333A((E111A**o===A****A&&...A''9444A((E111''+OOOA****A&&)333A'';666A((E111''3	4	4 A****A&&'111	I y A%%%A''3...A((E111A**o===A&&...".....r   c                     [        S5      n U R                  b   eU R                  c   e[        U R                  5      S:X  d   e[        S5      n U R                  c   eU R                  R                  b   eU R                  R
                  S:X  d   eU R                  R                  (       a   eU R                  U R                  /:X  d   e[        S5      n U R                  c   eU R                  R                  S:X  d   eU R                  R
                  S:X  d   eU R                  R                  (       a   eU R                  U R                  /:X  d   e[        S5      n U R                  c   eU R                  R                  S:X  d   eU R                  R
                  S:X  d   eU R                  R                  (       a   eU R                  U R                  /:X  d   eg)	zTest parsing returns.#
        Short description
        Nr   zA
        Short description
        :returns: description
        r   zE
        Short description
        :returns int: description
        rB   zU
        Short description
        :returns: description
        :rtype: int
        r   returnsmany_returnsr'   rK   r   is_generatorr-   s    r   test_returnsrU   I  s   	I
 $$$!!---y%%&!+++	I (((&&...((M999  ----!!i&7&7%8888	I (((&&%///((M999  ----!!i&7&7%8888	I (((&&%///((M999  ----!!i&7&7%8888r   c                  f   [        S5      n U R                  b   eU R                  c   e[        U R                  5      S:X  d   e[        S5      n U R                  c   eU R                  R                  b   eU R                  R
                  S:X  d   eU R                  R                  (       d   eU R                  c   e[        U R                  5      S:X  d   eU R                  S   U R                  :X  d   e[        S5      n U R                  c   eU R                  R                  S:X  d   eU R                  R
                  S:X  d   eU R                  R                  (       d   eU R                  c   e[        U R                  5      S:X  d   eU R                  S   U R                  :X  d   eg)	zTest parsing yields.rP   Nr   z@
        Short description
        :yields: description
        r   r%   zD
        Short description
        :yields int: description
        rB   rQ   r-   s    r   test_yieldsrW   z  s   	I
 $$$!!---y%%&!+++	I (((&&...((M999))))!!---y%%&!+++!!!$	(9(9999	I (((&&%///((M999))))!!---y%%&!+++!!!$	(9(9999r   c                     [        S5      n [        U R                  5      S:X  d   e[        S5      n [        U R                  5      S:X  d   eU R                  S   R                  b   eU R                  S   R                  S:X  d   e[        S5      n [        U R                  5      S:X  d   eU R                  S   R                  S:X  d   eU R                  S   R                  S:X  d   eg)	zTest parsing raises.rP   r   z@
        Short description
        :raises: description
        r%   Nr   zK
        Short description
        :raises ValueError: description
        
ValueError)r   r'   raisesrK   r   r-   s    r   test_raisesr[     s    	I
 y A%%%	I y A%%%A((000A**m;;;	I y A%%%A((L888A**m;;;r   c                     [         R                  " [        5         [        S5        SSS5        [         R                  " [        5         [        S5        SSS5        [         R                  " [        5         [        S5        SSS5        [         R                  " [        5         [        S5        SSS5        [        S5        g! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       Nj= f! , (       d  f       NM= f)zTest parsing broken meta.:Nz:param herp derpz:param: invalidz:param with too many args: descz:sthstrange: desc)pytestrZ   r   r    r   r   test_broken_metar`     s    	z	"c
 
# 
z	" ! 
# 
z	"  
# 
z	"/0 
# 

 
#	" 
#	" 
#	" 
#	"s/   C	C7C'%C8
C
C$'
C58
Dc                  F   [        S5      n U R                  c   eU R                  R                  S:X  d   eU R                  R                  S:X  d   e[        S5      n U R                  c   eU R                  R                  b   eU R                  R                  S:X  d   eg)zTest parsing deprecation notes.z1:deprecation: 1.1.0 this function will be removedNz1.1.0zthis function will be removedz+:deprecation: this function will be removed)r   deprecationversionr   r-   s    r   test_deprecationrd     s    IJI  ,,,  ((G333  ,,0OOOOCDI  ,,,  ((000  ,,0OOOOr   zrendering_style, expectedzShort description.

Long description.

:param int foo: a description
:param int bar: another description
:returns float: a returnzShort description.

Long description.

:param foo:
    a description
:type foo: int
:param bar:
    another description
:type bar: int
:returns:
    a return
:rtype: floatrendering_stylec                 8    [        S5      n[        X S9U:X  d   eg)zTest composez
        Short description.

        Long description.

        :param int foo: a description
        :param int bar: another description
        :return float: a return
        re   N)r   r   )re   r   r   s      r   test_composerh     s)    X 	
I 9>(JJJr   c                  \    Sn [        U 5      n[        R                  n[        XS9U :X  d   eg)z=Test abbreviated docstring with only return type information.z!Short description.

:rtype: floatrg   N)r   r   EXPANDEDr   )stringr   re   s      r   test_short_rtyperl     s.    2FfI$--O9>&HHHr   )r   N) __doc__typingTr^   docstring_parser.commonr   r   docstring_parser.restr   r   markparametrizerD   r   boolr   Optionalr(   r.   r7   r=   rN   rU   rW   r[   r`   rd   COMPACTCLEANrj   rh   rl   r_   r   r   <module>rx      s   .   > 0 	3 # $ 	 E;>~  	
 
>~ L	Qd$$C$ 

3$  $	$
 #$ 

3$ 
$eQd$$?$302?/D.9b%:P<<$
P  ""'		
   '		
 ##	
+%(RK. KC KD KS(RK"Ir   