
    Rtf                     b    d dl Z d dlZd dlZd dlZd dlZd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zy)    Nc                     t        j                         }|t        j                  ct        _        }	  | |i | |j	                         j                  d      |t        _        S # |t        _        w xY w)a+  
    Return stdout of calling `func_name`.

    This docstring should be perfect, as it is used to test the
    validation with a docstring without errors.

    Parameters
    ----------
    func_name : callable
        Function to be called.
    *args, **kwargs
        Will be passed to `func_name`.

    Returns
    -------
    str
        The content that the function printed.

    See Also
    --------
    sys.stdout : Python's file handler for stdout.

    Examples
    --------
    >>> _capture_stdout(print, 'hello world')
    'hello world'
    z
)ioStringIOsysstdoutgetvaluestrip)	func_nameargskwargsf
old_stdouts        :/usr/lib/python3/dist-packages/numpydoc/tests/test_main.py_capture_stdoutr      sV    8 	A

CJ
 4"6"zz|!!&)
Z
s   &A$ $A1c                       y)zi
    this docstring should report some errors

    Parameters
    ----------
    made_up_param : str
    N r       r   _docstring_with_errorsr   -        	r   c                       y)zc
    This docstring should break the parsing.

    See Also
    --------
    : this is invalid
    Nr   r   r   r   _invalid_docstringr   8   r   r   c                  r    t        t        j                  j                  d      } | j	                  d      sJ y )Nnumpydocz)This package provides the numpydoc Sphinxr   r   __main__render_object
startswithouts    r   test_renders_package_docstringr    C   s-    
(++99:
FC>>EFFFr   c                  r    t        t        j                  j                  d      } | j	                  d      sJ y )Nznumpydoc.__main__z0Implementing `python -m numpydoc` functionality.r   r   s    r   test_renders_module_docstringr"   H   s.    
(++99;N
OC>>LMMMr   c                  r    t        t        j                  j                  d      } | j	                  d      sJ y )N(numpydoc.tests.test_main._capture_stdoutzReturn stdout of callingr   r   s    r   test_renders_function_docstringr%   M   s3    
'')SC >>4555r   c                      t         j                  j                  d      } | dk(  sJ t        j                  t
              5  t         j                  j                  d       d d d        y # 1 sw Y   y xY w)Nr$   r   z+numpydoc.tests.test_main._invalid_docstring)r   r   r   pytestraises
ValueError)exit_statuss    r   .test_render_object_returns_correct_exit_statusr+   T   se    ##112K !	z	" W''(UVW W Ws     A))A2c                      t        t        j                  j                  d      } d| v sJ d| v sJ t        j                  j                  d      }|dkD  sJ y )Nz/numpydoc.tests.test_main._docstring_with_errorsSS02z,Summary does not start with a capital letterr   r   r   r   validate_objectr   r*   s     r   test_validate_detects_errorsr1   ^   sa    
))9C S==9S@@@##339K ??r   c                      t        t        j                  j                  d      } | dk(  sJ t        j                  j                  d      }|dk(  sJ y )Nr$    r   r.   r0   s     r   test_validate_perfect_docstringr4   l   sU    
))+UC "99##332K !r   )r   r   r'   r   numpydoc.__main__r   r   r   r    r"   r%   r+   r1   r4   r   r   r   <module>r6      sE    
 	   " J		G
N
6W	r   