
    
`i                     \    U d Z ddlmZ ddlmZ dZeed<   	 ddZdd	Z	dd
Z
ddZddZdS )z>Tests for parse_from_object function and attribute docstrings.    )patch)parse_from_object   module_attrreturnNc                  
   ddl m}  t          |           }d|j        v s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 dS )	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     /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/docstring_parser/tests/test_parse_from_object.py%test_from_module_attribute_docstringsr      s    ((((((!"899I)"=====y  A%%%%A'=8888A(E1111A*.KKKKKKK    c                      G d d          } t          |           }|j        dk    sJ |j        dk    sJ |j        dk    s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 dS )z4Test the parse of attribute docstrings from a class.c                   .    e Zd ZU dZeed<   	 dZeed<   dS ):test_from_class_attribute_docstrings.<locals>.StandardCasez3Short description
        Long description
        attr_oneFattr_twoN)__name__
__module____qualname____doc__str__annotations__r   bool 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)      sD   ' ' ' ' ' ' ' ' ",//I&*=====%);;;;; $IIIIIy  A%%%%A':5555A(E1111A*.HHHHHA':5555A(F2222A*.HHHHHHHr   c                  0    G d d          } t          |           }|j        J |j        J |j        J t	          |j                  dk    sJ |j        d         j        dk    sJ |j        d         j        J |j        d         j        dk    sJ dS )z/Test the parse of untyped attribute docstrings.c                       e Zd ZdZdS )Ftest_from_class_attribute_docstrings_without_type.<locals>.WithoutTypevalueN)r   r   r   r   r"   r   r   WithoutTyper,   6   s        &&r   r.   Nr   r   r   r&   r'   )r.   r   s     r   1test_from_class_attribute_docstrings_without_typer/   3   s    ' ' ' ' ' ' ' ' "+..I&...%--- (((y  A%%%%A':5555A(000A*.HHHHHHHr   c                  $    G d d          } t          dt          d                    5  t          |           }ddd           n# 1 swxY w Y   |j        dk    sJ |j        J |j        dk    sJ t          |j                  dk    sJ dS )	z3Test the parse of class when source is unavailable.c                       e Zd ZU dZeed<   dS )5test_from_class_without_source.<locals>.WithoutSourcer$   r   N)r   r   r   r   r   r    r"   r   r   WithoutSourcer2   H   s!         &&r   r3   zinspect.getsourcezcould not get source code)side_effectNr$   r   )r   OSErrorr   r   r(   r   r   r   )r3   r   s     r   test_from_class_without_sourcer6   E   s   ' ' ' ' ' ' ' ' 
1L)M)M
 
 
 5 5 &m44	5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
 &*=====%--- $77777y  A%%%%%%s   AAAc                     ddt           dt          fd} t          |           }|j        dk    sJ |j        dk    sJ 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        J |j        d	         j        d
k    sJ dS )z'Test the parse of a function docstring.r%   param1param2c                     |  d| S )z~Short description
        Args:
            param1: Description for param1
            param2: Description for param2
         r"   )r8   r9   s     r   
a_functionz&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_functionr=   Y   s$   $ $3 $ $ $ $ $ "*--I&*===== $77777y  A%%%%A'83333A(000A*.FFFFFA'83333A(000A*.FFFFFFFr   )r   N)r   unittest.mockr   docstring_parserr   r   r
   r    r   r)   r/   r6   r=   r"   r   r   <module>r@      s    D D D       . . . . . .S    !
L 
L 
L 
LI I I I6I I I I$& & & &(G G G G G Gr   