
    `j/                         d Z ddlmZ ddlmZ ej        Zej        Zej        Z G d dej                  Ze	dk    r ej
                     dS dS )z!Tests for fire docstrings module.    )
docstrings)	testutilsc                   z    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd ZdS )DocstringsTestc                 ~    d}t          j        |          }t          d          }|                     ||           d S )NA simple one line docstring.summaryr   parseDocstringInfoassertEqualself	docstringdocstring_infoexpected_docstring_infos       X/home/jworkman/hermes-web-chat/venv/lib/python3.11/site-packages/fire/docstrings_test.pytest_one_line_simplez#DocstringsTest.test_one_line_simple   sN    2I%i00N+.   	,n=====    c                 ~    d}t          j        |          }t          d          }|                     ||           d S )Nz(
      A simple one line docstring.
    r   r	   r   r   s       r   test_one_line_simple_whitespacez.DocstringsTest.test_one_line_simple_whitespace%   sR    I  %i00N+.   	,n=====r   c                 ~    d}t          j        |          }t          d          }|                     ||           d S )NzA one line docstring that is both a little too verbose and a little too long so it keeps going well beyond a reasonable length for a one-liner.
    zA one line docstring that is both a little too verbose and a little too long so it keeps going well beyond a reasonable length for a one-liner.r	   r   r   s       r   test_one_line_too_longz%DocstringsTest.test_one_line_too_long/   sT    I  %i00N+  
 	,n=====r   c                 ~    d}t          j        |          }t          d          }|                     ||           d S )NztA one line docstring that is both a little too verbose and a little too long
    so it runs onto a second line.
    kA one line docstring that is both a little too verbose and a little too long so it runs onto a second line.r	   r   r   s       r   test_one_line_runs_overz&DocstringsTest.test_one_line_runs_over<   sT    I  %i00N+;   	,n=====r   c                 ~    d}t          j        |          }t          d          }|                     ||           d S )Nz}
      A one line docstring that is both a little too verbose and a little too long
      so it runs onto a second line.
    r   r	   r   r   s       r   "test_one_line_runs_over_whitespacez1DocstringsTest.test_one_line_runs_over_whitespaceI   sT    I  %i00N+;   	,n=====r   c                     d}t          j        |          }t          dt          dd          t          dd          g          }|                     ||           d S )	Nz_One line description.

    Args:
      arg1: arg1_description
      arg2: arg2_description
    zOne line description.arg1arg1_descriptionnamedescriptionarg2arg2_descriptionr
   argsr   r   r   ArgInfor   r   s       r   test_google_format_args_onlyz+DocstringsTest.test_google_format_args_onlyU   sy    I  %i00N+'-?@@@-?@@@
   	,n=====r   c                     d}t          j        |          }t          t          dd          g          }|                     ||           d S )Nz+
    Args:
      args: arg_description
    r)   arg_descriptionr#   )r)   r*   r   s       r   !test_google_format_arg_named_argsz0DocstringsTest.test_google_format_arg_named_argsf   se    I  %i00N+->???
  
 	,n=====r   c           
          d}t          j        |          }t          ddt          ddd          t          dd	d
          gd          }|                     ||           d S )Na*  Docstring summary.

    This is a longer description of the docstring. It spans multiple lines, as
    is allowed.

    Args:
        param1 (int): The first parameter.
        param2 (str): The second parameter.

    Returns:
        bool: The return value. True for success, False otherwise.
    Docstring summary.VThis is a longer description of the docstring. It spans multiple lines, as
is allowed.param1intThe first parameter.r$   typer%   param2strThe second parameter.z:bool: The return value. True for success, False otherwise.r
   r%   r)   returnsr*   r   s       r   )test_google_format_typed_args_and_returnsz8DocstringsTest.test_google_format_typed_args_and_returnss   s    I  %i00N+$*  68 8 8 79 9 9
 M   	,n=====r   c           
          d}t          j        |          }t          ddt          ddd          t          dd	d
          g          }|                     ||           d S )Na  Docstring summary.

    This is a longer description of the docstring. It spans multiple lines, as
    is allowed.

    Args:
        param1 (int): The first parameter.
        param2 (str): The second parameter. This has a lot of text, enough to
        cover two lines.
    r1   r2   r3   r4   r5   r6   r8   r9   HThe second parameter. This has a lot of text, enough to cover two lines.r
   r%   r)   r*   r   s       r   ,test_google_format_multiline_arg_descriptionz;DocstringsTest.test_google_format_multiline_arg_description   s    	I  %i00N+$*  68 8 8!=> > >
	   	,n=====r   c           
          d}t          j        |          }t          ddt          ddd          t          dd	d
          gdd          }|                     ||           d S )NaD  Docstring summary.

    This is a longer description of the docstring. It spans across multiple
    lines.

    :param arg1: Description of arg1.
    :type arg1: str.
    :param arg2: Description of arg2.
    :type arg2: bool.
    :returns:  int -- description of the return value.
    :raises: AttributeError, KeyError
    r1   NThis is a longer description of the docstring. It spans across multiple
lines.r!   r9   Description of arg1.r6   r&   boolDescription of arg2.z'int -- description of the return value.zAttributeError, KeyError)r
   r%   r)   r<   raisesr*   r   s       r   &test_rst_format_typed_args_and_returnsz5DocstringsTest.test_rst_format_typed_args_and_returns   s    I  %i00N+$" e 68 8 8f 68 8 8
 :)   	,n=====r   c           
          d}t          j        |          }t          ddt          ddd          t          dd	d
          gd          }|                     ||           d S )Na:  Docstring summary.

    This is a longer description of the docstring. It spans across multiple
    lines.

    Parameters
    ----------
    param1 : int
        The first parameter.
    param2 : str
        The second parameter.

    Returns
    -------
    bool
        True if successful, False otherwise.
    r1   rC   r3   r4   r5   r6   r8   r9   r:   z)bool True if successful, False otherwise.r;   r*   r   s       r   (test_numpy_format_typed_args_and_returnsz7DocstringsTest.test_numpy_format_typed_args_and_returns   s    I"  %i00N+$"  68 8 8 79 9 9
 <   	,n=====r   c           
          d}t          j        |          }t          ddt          ddd          t          dd	d
          g          }|                     ||           d S )Na&  Docstring summary.

    This is a longer description of the docstring. It spans across multiple
    lines.

    Parameters
    ----------
    param1 : int
        The first parameter.
    param2 : str
        The second parameter. This has a lot of text, enough to cover two
        lines.
    r1   rC   r3   r4   r5   r6   r8   r9   r?   r@   r*   r   s       r   +test_numpy_format_multiline_arg_descriptionz:DocstringsTest.test_numpy_format_multiline_arg_description   s    I  %i00N+$"  68 8 8!=> > >
	   	,n=====r   c                     d}t          j        |          }t          dd          }|                     ||           d S )NzDocstring summary.

    This is the first section of a docstring description.

    This is the second section of a docstring description. This docstring
    description has just two sections.
    r1   zThis is the first section of a docstring description.

This is the second section of a docstring description. This docstring
description has just two sections.)r
   r%   r   r   s       r   test_multisection_docstringz*DocstringsTest.test_multisection_docstring  sW    I  %i00N+$-   	,n=====r   c                 h    d}t          j        |          }|                     d|j                   d S )NztInspired by requests HTTPAdapter docstring.

    :param x: Simple param.

    Usage:

      >>> import requests
    z+Inspired by requests HTTPAdapter docstring.)r   r   r   r
   )r   r   r   s      r   )test_google_section_with_blank_first_linez8DocstringsTest.test_google_section_with_blank_first_line  sF    I  %i00NB#+- - - - -r   c                 2    d}t          j        |           d S )NzDocstring summary.

    args: raises ::
    :
    pathological docstrings should not fail, and ideally should behave
    reasonably.
    )r   r   )r   r   s     r   test_ill_formed_docstringz(DocstringsTest.test_ill_formed_docstring%  s"    I Yr   c                 d    g d}dg}|                      |t          j        |                     d S )N)     foo  rT   rU   )r   r   _strip_blank_lines)r   linesexpected_outputs      r   test_strip_blank_linesz%DocstringsTest.test_strip_blank_lines/  s;    %%%E kO_j&CE&J&JKKKKKr   c                     d}t          j        |          }t          dd t          ddd          t          ddd	          t          d
dd           g          }|                     ||           d S )Nz
     Greets name.

     Arguments
     ---------
     name : str
         name, default : World
     arg2 : int
         arg2, default:None
     arg3 : bool
     zGreets name.r$   r9   zname, default : Worldr6   r&   r4   zarg2, default:Nonearg3rE   r@   r*   r   s       r   test_numpy_colon_in_descriptionz.DocstringsTest.test_numpy_colon_in_description5  s    
	I  %i00N+e 79 9 9e 46 6 6f$???

 
 
 	,n=====r   c           
          d}t          j        |          }t          dt          ddd          t	          ddd	          t	          d
dd          g          }|                     ||           d S )NzDocstring summary.

    :param arg1: Description of arg1.
    :type arg1: str.
    :key arg2: Description of arg2.
    :type arg2: bool.
    :key arg3: Description of arg3.
    :type arg3: str.
    r1   r!   r9   rD   r6   r&   rE   rF   r[   zDescription of arg3.r(   )r   r   r   r+   	KwargInfor   r   s       r   %test_rst_format_typed_args_and_kwargsz4DocstringsTest.test_rst_format_typed_args_and_kwargsO  s    I  %i00N+$e 68 8 86"8: : :6"8: : :

 
 
 	,n=====r   N)__name__
__module____qualname__r   r   r   r   r   r,   r/   r=   rA   rH   rJ   rL   rN   rP   rR   rY   r\   r_    r   r   r   r      s&       > > >> > >> > >> > >
> 
> 
>> > >"> > >> > >8> > >4> > >: >  >  >D> > >:> > >&- - -     L L L> > >4> > > > >r   r   __main__N)__doc__firer   r   r   r+   r^   BaseTestCaser   r`   mainrc   r   r   <module>ri      s    ( '             (

 	J> J> J> J> J>Y+ J> J> J>Z
 z). r   