
    h                     d    % S r SSKJr  SSKJr  Sr\\S'    SS jrSS jr	SS	 jr
SS
 jrSS jrg)z>Tests for parse_from_object function and attribute docstrings.    )patch)parse_from_object   module_attrNc                  :   SSK Jn   [        U 5      nSUR                  ;   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g)	z5Test the parse of attribute docstrings from a module.r   )test_parse_from_objectr   r   r   intzDescription for module_attrN)	 r   r   short_descriptionlenparamsarg_name	type_namedescription)r   	docstrings     g/home/james-whalen/.local/lib/python3.13/site-packages/docstring_parser/tests/test_parse_from_object.py%test_from_module_attribute_docstringsr      s    (!"89I)"="====y A%%%A''=888A((E111A**.KKKK    c                  D    " S S5      n [        U 5      nUR                  S:X  d   eUR                  S:X  d   e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)z4Test the parse of attribute docstrings from a class.c                   4    \ rS rSr% Sr\\S'    Sr\\S'   Sr	g):test_from_class_attribute_docstrings.<locals>.StandardCase   z#Short description
Long description
attr_oneFattr_two N)
__name__
__module____qualname____firstlineno____doc__str__annotations__r   bool__static_attributes__r   r   r   StandardCaser      s    	 &$&r   r%   Short descriptionzLong descriptionz"Short description
Long description   r   r   r!   Description for attr_oner   r   r#   zDescription for attr_twoNr   r   long_descriptionr   r   r   r   r   )r%   r   s     r   $test_from_class_attribute_docstringsr+      s,   ' ' ",/I&&*====%%);;;;  $IIIIy A%%%A'':555A((E111A**.HHHHA'':555A((F222A**.HHHHr   c                  r    " S S5      n [        U 5      nUR                  b   eUR                  b   eUR                  b   e[	        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g)z/Test the parse of untyped attribute docstrings.c                       \ rS rSrSrSrg)Ftest_from_class_attribute_docstrings_without_type.<locals>.WithoutType6   valuer   N)r   r   r   r   r   r$   r   r   r   WithoutTyper.   6   s
    &r   r1   Nr   r   r   r(   r)   )r1   r   s     r   1test_from_class_attribute_docstrings_without_typer2   3   s    ' ' "+.I&&...%%---  (((y A%%%A'':555A((000A**.HHHHr   c                  $    " S S5      n [        S[        S5      S9   [        U 5      nSSS5        WR                  S:X  d   eUR                  b   eUR
                  S:X  d   e[        UR                  5      S:X  d   eg! , (       d  f       N]= f)	z3Test the parse of class when source is unavailable.c                   $    \ rS rSr% Sr\\S'   Srg)5test_from_class_without_source.<locals>.WithoutSourceH   r&   r   r   N)r   r   r   r   r    r!   r"   r$   r   r   r   WithoutSourcer5   H   s    &r   r7   zinspect.getsourcezcould not get source code)side_effectNr&   r   )r   OSErrorr   r   r*   r   r   r   )r7   r   s     r   test_from_class_without_sourcer:   E   s    ' ' 
1L)M
 &m4	

 &&*====%%---  $7777y A%%%
 
s   B
Bc                  &   SS[         S[        4S jjn [        U 5      nUR                  S:X  d   e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                  b   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                  S
:X  d   eg)z'Test the parse of a function docstring.r'   param1param2c                     U  SU 3$ )z^Short description
Args:
    param1: Description for param1
    param2: Description for param2
 r   )r<   r=   s     r   
a_function&test_from_function.<locals>.a_function\   s     6(##r   r&   r   NzDescription for param1r   zDescription for param2)r'   )	r!   r	   r   r   r   r   r   r   r   )r@   r   s     r   test_from_functionrB   Y   s   $3 $ $ "*-I&&*====  $7777y A%%%A''8333A((000A**.FFFFA''8333A((000A**.FFFFr   )returnN)r    unittest.mockr   docstring_parserr   r   r	   r"   r   r+   r2   r:   rB   r   r   r   <module>rF      s8    D  .S  !
LI6I$&(Gr   