Your IP : 18.117.11.13


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/doctest.cpython-33.pyc

�
��f�c @s�dZdZdddddddd	d
ddd
ddddddddddddddddddd d!g Zd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#l	Z	d"d#l
Z
d"d#lZd"d#lZd"d$l
mZd"d%lmZed&d'�ZiZd(d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed
�Zed�Zed�Zed
�ZeeBeBeBZd)Z d*Z!d+d,�Z"d-d.d/�Z#d0d1�Z$d2d3d4�Z%d5d6�Z&Gd7d8�d8e�Z'd9d:�Z(d;d<�Z)d=d>�Z*Gd?d@�d@ej+�Z,dAdB�Z-GdCd�d�Z.GdDd�d�Z/GdEd�d�Z0GdFd�d�Z1GdGd�d�Z2GdHd�d�Z3GdId�de4�Z5GdJd�de4�Z6GdKd�de2�Z7e8a9e8e8e8e8e:d"e8e;e;dLd�	Z<e:e8e8e8e8e:d"e8e;e0�e8dMd�Z=e;dNe8d"dOd�Z>d"a?dPd�Z@GdQdR�dRejA�ZBGdSdT�dTeB�ZCe8e8e8e8dUd�ZDGdVdW�dWeB�ZEe:e8e8e0�e8dXdY�ZFdZd�ZGd[d�ZHd\d�ZIe;e8d]d �ZJe;e8d^d_�ZKe;d`d!�ZLGdadb�db�ZMieMdb6dcdd6dedf6dgdh6didj6dkdl6ZNdmdn�ZOePdokr�e
jQeO��nd#S(pu�Module doctest -- a framework for running examples in docstrings.

In simplest use, end each module M to be tested with:

def _test():
    import doctest
    doctest.testmod()

if __name__ == "__main__":
    _test()

Then running the module as a script will cause the examples in the
docstrings to get executed and verified:

python M.py

This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout
(why not stderr? because stderr is a lame hack <0.2 wink>), and the final
line of output is "Test failed.".

Run it with the -v switch instead:

python M.py -v

and a detailed report of all examples tried is printed to stdout, along
with assorted summaries at the end.

You can force verbose mode by passing "verbose=True" to testmod, or prohibit
it by passing "verbose=False".  In either of those cases, sys.argv is not
examined by testmod.

There are a variety of other ways to run doctests, including integration
with the unittest framework, and support for running non-Python text
files containing doctests.  There are also many ways to override parts
of doctest's default behaviors.  See the Library Reference Manual for
details.
ureStructuredText enuregister_optionflaguDONT_ACCEPT_TRUE_FOR_1uDONT_ACCEPT_BLANKLINEuNORMALIZE_WHITESPACEuELLIPSISuSKIPuIGNORE_EXCEPTION_DETAILuCOMPARISON_FLAGSuREPORT_UDIFFuREPORT_CDIFFuREPORT_NDIFFuREPORT_ONLY_FIRST_FAILUREuREPORTING_FLAGSuExampleuDocTestu
DocTestParseru
DocTestFinderu
DocTestRunneru
OutputCheckeruDocTestFailureuUnexpectedExceptionuDebugRunnerutestmodutestfileurun_docstring_examplesuDocTestSuiteuDocFileSuiteuset_unittest_reportflagsuscript_from_examplesu
testsourceu	debug_srcudebugiN(uStringIO(u
namedtupleuTestResultsufailed attemptedcCstj|dtt�>�S(Ni(uOPTIONFLAGS_BY_NAMEu
setdefaultulen(uname((u,/opt/alt/python33/lib64/python3.3/doctest.pyuregister_optionflag�su<BLANKLINE>u...cCsUd}xHtjD]=}|j|d�}|tt|�kr||jO}qqW|S(u�
    Return the compiler-flags associated with the future features that
    have been imported into the given namespace (globs).
    iN(u
__future__uall_feature_namesugetuNoneugetattru
compiler_flag(uglobsuflagsufnameufeature((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_extract_future_flags�su_extract_future_flagsicCsutj|�r|St|t�r>t|t�t�dg�S|dkretj	tj
|�jdStd��dS(u�
    Return the module specified by `module`.  In particular:
      - If `module` is a module, then return module.
      - If `module` is a string, then import and return the
        module with that name.
      - If `module` is None, then return the calling module.
        The calling module is assumed to be the module of
        the stack frame at the given depth in the call stack.
    u*u__name__u"Expected a module, string, or NoneN(
uinspectuismoduleu
isinstanceustru
__import__uglobalsulocalsuNoneusysumodulesu	_getframeu	f_globalsu	TypeError(umoduleudepth((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_normalize_module�s
u_normalize_modulec	Cs�|r�t|d�}t||�}t|d�r�t|jd�r�|jj|�}|j|�}|jtjd�|fSq�nt	|d|��}|j
�|fSWdQXdS(Niu
__loader__uget_datau
uencoding(u_normalize_moduleu_module_relative_pathuhasattru
__loader__uget_dataudecodeureplaceuosulinesepuopenuread(ufilenameupackageumodule_relativeuencodingu
file_contentsuf((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_load_testfile�su_load_testfileicCstjd|d|�S(u~
    Add the given number of space characters to the beginning of
    every non-blank line in `s`, and return the result.
    u
(?m)^(?!$)u (ureusub(usuindent((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_indent�su_indentcCs;t�}|\}}}tj|||d|�|j�S(uz
    Return a string containing a traceback message for the given
    exc_info tuple (as returned by sys.exc_info()).
    ufile(uStringIOu	tracebackuprint_exceptionugetvalue(uexc_infouexcoutuexc_typeuexc_valuexc_tb((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_exception_traceback�s	u_exception_tracebackcBs/|EeZdZdd�Zddd�ZdS(u	_SpoofOutcCs6tj|�}|r2|jd�r2|d7}n|S(Nu
(uStringIOugetvalueuendswith(uselfuresult((u,/opt/alt/python33/lib64/python3.3/doctest.pyugetvalue�s
u_SpoofOut.getvaluecCs|j|�tj|�dS(N(useekuStringIOutruncate(uselfusize((u,/opt/alt/python33/lib64/python3.3/doctest.pyutruncate�s
u_SpoofOut.truncateN(u__name__u
__module__u__qualname__ugetvalueuNoneutruncate(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	_SpoofOut�s	u	_SpoofOutcCs&t|kr||kS|jt�}t|�dks=t�dt|�}}|d}|r�|j|�r�t|�}|d=q�dSn|d}|r�|j|�r�|t|�8}|d=q�dSn||kr�dSxC|D];}|j|||�}|dkrdS|t|�7}q�WdS(u_
    Essentially the only subtle case:
    >>> _ellipsis_match('aa...aa', 'aaa')
    False
    iiiFi����i����T(	uELLIPSIS_MARKERusplitulenuAssertionErroru
startswithuFalseuendswithufinduTrue(uwantugotuwsustartposuendposuw((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_ellipsis_matchs2





u_ellipsis_matchcCs"|j�}|rd|SdSdS(u)Return a commented form of the given lineu# u#N(urstrip(uline((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
_comment_line5su
_comment_linecCs�dt|�}}|jd�}|dkr7|}n|jdd|�}|dkra|}n|jdd|�}|dkr�|d}n|||�S(Niu
u:u.i(ulenufindurfind(umsgustartuendui((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_strip_exception_details=s		
u_strip_exception_detailscBsM|EeZdZdZdd�Zd
dd�Zdd�Zdd	�Zd
S(u_OutputRedirectingPdbu�
    A specialized version of the python debugger that redirects stdout
    to a given stream when interacting with the user.  Stdout is *not*
    redirected when traced code is executed.
    cCs;||_d|_tjj|d|dd�d|_dS(NustdoutunosigintiFT(u_OutputRedirectingPdb__outuFalseu$_OutputRedirectingPdb__debugger_usedupdbuPdbu__init__uTrueuuse_rawinput(uselfuout((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__]s		u_OutputRedirectingPdb.__init__cCs>d|_|dkr'tj�j}ntjj||�dS(NT(	uTrueu$_OutputRedirectingPdb__debugger_useduNoneusysu	_getframeuf_backupdbuPdbu	set_trace(uselfuframe((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	set_tracees	u_OutputRedirectingPdb.set_tracecCs |jrtjj|�ndS(N(u$_OutputRedirectingPdb__debugger_usedupdbuPdbuset_continue(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyuset_continueks	u"_OutputRedirectingPdb.set_continuecGs=tj}|jt_ztjj||�SWd|t_XdS(N(usysustdoutu_OutputRedirectingPdb__outupdbuPdbutrace_dispatch(uselfuargsusave_stdout((u,/opt/alt/python33/lib64/python3.3/doctest.pyutrace_dispatchqs
	u$_OutputRedirectingPdb.trace_dispatchN(	u__name__u
__module__u__qualname__u__doc__u__init__uNoneu	set_traceuset_continueutrace_dispatch(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_OutputRedirectingPdbWs
u_OutputRedirectingPdbcCs�tj|�s"td|��n|jd�r@td��nt|d�rktjj|j	�d}nw|j
dkr�ttj
�dkr�tj
ddkr�tjjtj
d�d}q�tj}ntd|d	��tjj||jd��S(
NuExpected a module: %ru/u1Module-relative files may not have absolute pathsu__file__iu__main__uu+Can't resolve paths relative to the module u (it has no __file__)(uinspectuismoduleu	TypeErroru
startswithu
ValueErroruhasattruosupathusplitu__file__u__name__ulenusysuargvucurdirujoin(umoduleupathubasedir((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_module_relative_path|s( u_module_relative_pathcBsV|EeZdZdZdddddd�Zdd�Zdd�Zd	d
�ZdS(uExampleun
    A single doctest example, consisting of source code and expected
    output.  `Example` defines the following attributes:

      - source: A single Python statement, always ending with a newline.
        The constructor adds a newline if needed.

      - want: The expected output from running the source code (either
        from stdout, or a traceback in case of exception).  `want` ends
        with a newline unless it's empty, in which case it's an empty
        string.  The constructor adds a newline if needed.

      - exc_msg: The exception message generated by the example, if
        the example is expected to generate an exception; or `None` if
        it is not expected to generate an exception.  This exception
        message is compared against the return value of
        `traceback.format_exception_only()`.  `exc_msg` ends with a
        newline unless it's `None`.  The constructor adds a newline
        if needed.

      - lineno: The line number within the DocTest string containing
        this Example where the Example begins.  This line number is
        zero-based, with respect to the beginning of the DocTest.

      - indent: The example's indentation in the DocTest string.
        I.e., the number of space characters that precede the
        example's first prompt.

      - options: A dictionary mapping from option flags to True or
        False, which is used to override default options for this
        example.  Any option flags not contained in this dictionary
        are left at their default value (as specified by the
        DocTestRunner's optionflags).  By default, no options are set.
    icCs�|jd�s|d7}n|r?|jd�r?|d7}n|dk	rh|jd�rh|d7}n||_||_||_||_|dkr�i}n||_||_dS(Nu
(uendswithuNoneusourceuwantulinenouindentuoptionsuexc_msg(uselfusourceuwantuexc_msgulinenouindentuoptions((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s


						uExample.__init__cCs�t|�t|�k	rtS|j|jko�|j|jko�|j|jko�|j|jko�|j|jko�|j|jkS(N(utypeuNotImplementedusourceuwantulinenouindentuoptionsuexc_msg(uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__eq__�suExample.__eq__cCs||kS(N((uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__ne__�suExample.__ne__cCs(t|j|j|j|j|jf�S(N(uhashusourceuwantulinenouindentuexc_msg(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__hash__�suExample.__hash__N(	u__name__u
__module__u__qualname__u__doc__uNoneu__init__u__eq__u__ne__u__hash__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuExample�s"	cBsb|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS(uDocTestue
    A collection of doctest examples that should be run in a single
    namespace.  Each `DocTest` defines the following attributes:

      - examples: the list of examples.

      - globs: The namespace (aka globals) that the examples should
        be run in.

      - name: A name identifying the DocTest (typically, the name of
        the object whose docstring this DocTest was extracted from).

      - filename: The name of the file that this DocTest was extracted
        from, or `None` if the filename is unknown.

      - lineno: The line number within filename where this DocTest
        begins, or `None` if the line number is unavailable.  This
        line number is zero-based, with respect to the beginning of
        the file.

      - docstring: The string that the examples were extracted from,
        or `None` if the string is unavailable.
    cCs\t|t�std��||_||_|j�|_||_||_||_	dS(u�
        Create a new DocTest containing the given examples.  The
        DocTest's globals are initialized with a copy of `globs`.
        u8DocTest no longer accepts str; use DocTestParser insteadN(
u
isinstanceustruAssertionErroruexamplesu	docstringucopyuglobsunameufilenameulineno(uselfuexamplesuglobsunameufilenameulinenou	docstring((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s					uDocTest.__init__cCslt|j�dkrd}n1t|j�dkr<d}ndt|j�}d|j|j|j|fS(Niuno examplesiu	1 exampleu%d examplesu<DocTest %s from %s:%s (%s)>(ulenuexamplesunameufilenameulineno(uselfuexamples((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__repr__
s		uDocTest.__repr__cCs�t|�t|�k	rtS|j|jko�|j|jko�|j|jko�|j|jko�|j|jko�|j|jkS(N(utypeuNotImplementeduexamplesu	docstringuglobsunameufilenameulineno(uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__eq__suDocTest.__eq__cCs||kS(N((uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__ne__"suDocTest.__ne__cCs"t|j|j|j|jf�S(N(uhashu	docstringunameufilenameulineno(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__hash__%suDocTest.__hash__cCsSt|t�stS|j|j|jt|�f|j|j|jt|�fkS(N(u
isinstanceuDocTestuNotImplementedunameufilenameulinenouid(uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__lt__)suDocTest.__lt__N(
u__name__u
__module__u__qualname__u__doc__u__init__u__repr__u__eq__u__ne__u__hash__u__lt__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocTest�s
cBs�|EeZdZdZejdejejB�ZejdejejBej	B�Z
ejd�jZddd�Z
dd	�Zdd
d�Zdd
�Zejdej�Zdd�Zejdej�Zdd�Zdd�Zdd�ZdS(u
DocTestParseruD
    A class used to parse strings containing doctest examples.
    u�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        u�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        u^[ ]*(#.*)?$u<string>c
s}|j�}|j|���dkrUdj�fdd�|jd�D��}ng}d	\}}x�|jj|�D]�}|j|||j���||jd||j��7}|j	|||�\}}}	}
|j
|�s-|jt||	|
d|d�t|j
d��d|��n||jd|j�|j��7}|j�}qzW|j||d��|S(
u=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        iu
cs g|]}|�d��qS(N((u.0ul(u
min_indent(u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>ps	u'DocTestParser.parse.<locals>.<listcomp>ulinenouindentuoptionsN(ii(u
expandtabsu_min_indentujoinusplitu_EXAMPLE_REufinditeruappendustartucountu_parse_exampleu_IS_BLANK_OR_COMMENTuExampleulenugroupuend(uselfustringunameuoutputucharnoulinenoumusourceuoptionsuwantuexc_msg((u
min_indentu,/opt/alt/python33/lib64/python3.3/doctest.pyuparseds&.!
%uDocTestParser.parsecCs%t|j||�|||||�S(u"
        Extract all doctest examples from the given string, and
        collect them into a `DocTest` object.

        `globs`, `name`, `filename`, and `lineno` are attributes for
        the new `DocTest` object.  See the documentation for `DocTest`
        for more information.
        (uDocTestuget_examples(uselfustringuglobsunameufilenameulineno((u,/opt/alt/python33/lib64/python3.3/doctest.pyuget_doctest�s	uDocTestParser.get_doctestcCsdd�|j||�D�S(u�
        Extract all doctest examples from the given string, and return
        them as a list of `Example` objects.  Line numbers are
        0-based, because it's most common in doctests that nothing
        interesting appears on the same line as opening triple-quote,
        and so the first interesting line is called "line 1" then.

        The optional argument `name` is a name identifying this
        string, and is only used for error messages.
        cSs%g|]}t|t�r|�qS((u
isinstanceuExample(u.0ux((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�s	u.DocTestParser.get_examples.<locals>.<listcomp>(uparse(uselfustringuname((u,/opt/alt/python33/lib64/python3.3/doctest.pyuget_examples�suDocTestParser.get_examplesc
sxt|jd���|jd�jd�}|j|�||�|j|dd�d�d||�dj�fdd	�|D��}|jd
�}|jd�}t|�dkr�tjd|d�r�|d=n|j|d�||t|��dj�fdd	�|D��}|jj|�}|rM|jd
�}nd}|j
|||�}	||	||fS(u�
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        uindentusourceu
iNu u.cs$g|]}|�dd��qS(iN((u.0usl(uindent(u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�s	u0DocTestParser._parse_example.<locals>.<listcomp>uwantu *$cs g|]}|�d��qS(N((u.0uwl(uindent(u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�s	umsgi����i����(ulenugroupusplitu_check_prompt_blanku
_check_prefixujoinureumatchu
_EXCEPTION_REuNoneu
_find_options(
uselfumunameulinenousource_linesusourceuwantu
want_linesuexc_msguoptions((uindentu,/opt/alt/python33/lib64/python3.3/doctest.pyu_parse_example�s$("(
"uDocTestParser._parse_exampleu#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}x�|jj|�D]�}|jd�jdd�j�}x||D]t}|ddkss|dd�tkr�td|d||f��nt|dd�}|ddk||<qGWqW|r�|j|�r�td	|||f��n|S(
u
        Return a dictionary containing option overrides extracted from
        option directives in the given source string.

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        iu,u iu+-Nu7line %r of the doctest for %s has an invalid option: %ru+uSline %r of the doctest for %s has an option directive on a line with no example: %r(u_OPTION_DIRECTIVE_REufinditerugroupureplaceusplituOPTIONFLAGS_BY_NAMEu
ValueErroru_IS_BLANK_OR_COMMENT(	uselfusourceunameulinenouoptionsumuoption_stringsuoptionuflag((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
_find_options�s!
uDocTestParser._find_optionsu
^([ ]*)(?=\S)cCsCdd�|jj|�D�}t|�dkr;t|�SdSdS(u;Return the minimum indentation of any non-blank line in `s`cSsg|]}t|��qS((ulen(u.0uindent((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�s	u-DocTestParser._min_indent.<locals>.<listcomp>iN(u
_INDENT_REufindallulenumin(uselfusuindents((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_min_indent�s
uDocTestParser._min_indentc
Cs�xyt|�D]k\}}t|�|dkr
||ddkr
td||d||||d�|f��q
q
WdS(u

        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.
        iiu u8line %r of the docstring for %s lacks blank after %s: %riN(u	enumerateulenu
ValueError(uselfulinesuindentunameulinenouiuline((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_check_prompt_blanks
*u!DocTestParser._check_prompt_blankcCs[xTt|�D]F\}}|r
|j|�r
td||d||f��q
q
WdS(u�
        Check that every line in the given list starts with the given
        prefix; if any line does not, then raise a ValueError.
        uGline %r of the docstring for %s has inconsistent leading whitespace: %riN(u	enumerateu
startswithu
ValueError(uselfulinesuprefixunameulinenouiuline((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
_check_prefixsuDocTestParser._check_prefixN(u__name__u
__module__u__qualname__u__doc__ureucompileu	MULTILINEuVERBOSEu_EXAMPLE_REuDOTALLu
_EXCEPTION_REumatchu_IS_BLANK_OR_COMMENTuparseuget_doctestuget_examplesu_parse_exampleu_OPTION_DIRECTIVE_REu
_find_optionsu
_INDENT_REu_min_indentu_check_prompt_blanku
_check_prefix(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
DocTestParser4s"'3	cBs}|EeZdZdZde�dddd�Zdddddd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS(u
DocTestFinderu<
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    cCs(||_||_||_||_dS(ut
        Create a new doctest finder.

        The optional argument `parser` specifies a class or
        function that should be used to create new DocTest objects (or
        objects that implement the same interface as DocTest).  The
        signature for this factory function should match the signature
        of the DocTest constructor.

        If the optional argument `recurse` is false, then `find` will
        only examine the given object, and not any contained objects.

        If the optional argument `exclude_empty` is false, then `find`
        will include tests for objects with empty docstrings.
        N(u_parseru_verboseu_recurseu_exclude_empty(uselfuverboseuparserurecurseu
exclude_empty((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__(s			uDocTestFinder.__init__c	Cs�|dkrIt|dd�}|dkrItdt|�f��qIn|dkr^d}n|dkr|tj|�}nytj|�}Wntk
r�d}Yn�X|s�tj	|�}|d|d	d�dks�d}q�n|dkr�d}nB|dk	r"t
j||j�}nt
j|�}|s@d}n|dkrs|dkrai}q|jj
�}n|j
�}|dk	r�|j|�nd|kr�d|d<ng}|j||||||i�|j�|S(
uj
        Return a list of the DocTests that are defined by the given
        object's docstring, or by any of its contained objects'
        docstrings.

        The optional parameter `module` is the module that contains
        the given object.  If the module is not specified or is None, then
        the test finder will attempt to automatically determine the
        correct module.  The object's module is used:

            - As a default namespace, if `globs` is not specified.
            - To prevent the DocTestFinder from extracting DocTests
              from objects that are imported from other modules.
            - To find the name of the file containing the object.
            - To help find the line number of the object within its
              file.

        Contained objects whose module does not match `module` are ignored.

        If `module` is False, no attempt to find the module will be made.
        This is obscure, of use mostly in tests:  if `module` is False, or
        is None but cannot be found automatically, then all objects are
        considered to belong to the (non-existent) module, so all contained
        objects will (recursively) be searched for doctests.

        The globals for each DocTest is formed by combining `globs`
        and `extraglobs` (bindings in `extraglobs` override bindings
        in `globs`).  A new copy of the globals dictionary is created
        for each DocTest.  If `globs` is not specified, then it
        defaults to the module's `__dict__`, if specified, or {}
        otherwise.  If `extraglobs` is not specified, then it defaults
        to {}.

        u__name__uJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %riiNu<]>u__main__Fi����(uNoneugetattru
ValueErrorutypeuFalseuinspectu	getmoduleu
getsourcefileu	TypeErrorugetfileu	linecacheugetlinesu__dict__ucopyuupdateu_findusort(	uselfuobjunameumoduleuglobsu
extraglobsufileusource_linesutests((u,/opt/alt/python33/lib64/python3.3/doctest.pyufind>sJ$	
			

uDocTestFinder.findcCs�|dkrdStj|�dk	r8|tj|�kStj|�rW|j|jkStj|�rv|j|j	kSt
|d�r�|j|j	kSt|t�r�dSt
d��dS(uY
        Return true if the given object is defined in the given
        module.
        u
__module__u"object must be a class or functionNT(uNoneuTrueuinspectu	getmoduleu
isfunctionu__dict__u__globals__uisclassu__name__u
__module__uhasattru
isinstanceupropertyu
ValueError(uselfumoduleuobject((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_from_module�suDocTestFinder._from_modulecCs|jrtd|�nt|�|kr0dSd|t|�<|j|||||�}|dk	rw|j|�ntj|�r|jrx�|j	j
�D]n\}	}
d||	f}	tj|
�s�tj|
�r�|j
||
�r�|j||
|	||||�q�q�Wntj|�r|jrx�t|di�j
�D]�\}	}
t|	t�s|tdt|	�f��ntj|
�p�tj|
�p�tj|
�p�tj|
�p�t|
t�s�tdt|
�f��nd||	f}	|j||
|	||||�qEWntj|�r
|jr
x�|j	j
�D]�\}	}
t|
t�rnt||	�}
nt|
t�r�t||	�j}
ntj|
�s�tj|
�s�t|
t�rA|j
||
�rAd||	f}	|j||
|	||||�qAqAWndS(	um
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        uFinding tests in %sNiu%s.%su__test__u5DocTestFinder.find: __test__ keys must be strings: %ru`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %ru%s.__test__.%s(u_verboseuprintuidu	_get_testuNoneuappenduinspectuismoduleu_recurseu__dict__uitemsu
isfunctionuisclassu_from_moduleu_findugetattru
isinstanceustru
ValueErrorutypeuismethodustaticmethoduclassmethodu__func__uproperty(uselfutestsuobjunameumoduleusource_linesuglobsuseenutestuvalnameuval((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_find�sP	%uDocTestFinder._findc	Cst|t�r|}ndyC|jdkr3d}n'|j}t|t�sZt|�}nWnttfk
r{d}YnX|j||�}|jr�|r�dS|dkr�d}n>t|d|j	�}|dd�d	kr�|dd
�}n|j
j|||||�S(us
        Return a DocTest for the given object, if it defines a docstring;
        otherwise, return None.
        uu__file__iNu.pycu.pyoii����(u.pycu.pyoi����(u
isinstanceustru__doc__uNoneu	TypeErroruAttributeErroru_find_linenou_exclude_emptyugetattru__name__u_parseruget_doctest(	uselfuobjunameumoduleuglobsusource_linesu	docstringulinenoufilename((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	_get_test�s(				uDocTestFinder._get_testcCs�d}tj|�rd}ntj|�r�|dkr=dStjdt|dd��}x6t|�D]%\}}|j|�ri|}PqiqiWntj	|�r�|j
}ntj|�r�|j}ntj
|�r�|j}ntj|�r|j}ntj|�r)t|dd�d}n|dk	r�|dkrI|dStjd�}x7t|t|��D]}|j||�rn|SqnWndS(	u�
        Return a line number of the given object's docstring.  Note:
        this method assumes that the object has a docstring.
        iu^\s*class\s*%s\bu__name__u-uco_firstlinenoiu(^|.*:)\s*\w*("|')N(uNoneuinspectuismoduleuisclassureucompileugetattru	enumerateumatchuismethodu__func__u
isfunctionu__code__uistracebackutb_frameuisframeuf_codeuiscodeurangeulen(uselfuobjusource_linesulinenoupatuiuline((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_find_linenos<		uDocTestFinder._find_linenoNFT(u__name__u
__module__u__qualname__u__doc__uFalseu
DocTestParseruTrueu__init__uNoneufindu_from_moduleu_findu	_get_testu_find_lineno(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
DocTestFinders	f?%cBs�|EeZdZdZddZddddd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ejd�Zddd�Zddddd�Zddd�Zdd�ZdS( u
DocTestRunneru3	
    A class used to run DocTest test cases, and accumulate statistics.
    The `run` method is used to process a single DocTest case.  It
    returns a tuple `(f, t)`, where `t` is the number of test cases
    tried, and `f` is the number of test cases that failed.

        >>> tests = DocTestFinder().find(_TestClass)
        >>> runner = DocTestRunner(verbose=False)
        >>> tests.sort(key = lambda test: test.name)
        >>> for test in tests:
        ...     print(test.name, '->', runner.run(test))
        _TestClass -> TestResults(failed=0, attempted=2)
        _TestClass.__init__ -> TestResults(failed=0, attempted=2)
        _TestClass.get -> TestResults(failed=0, attempted=2)
        _TestClass.square -> TestResults(failed=0, attempted=1)

    The `summarize` method prints a summary of all the test cases that
    have been run by the runner, and returns an aggregated `(f, t)`
    tuple:

        >>> runner.summarize(verbose=1)
        4 items passed all tests:
           2 tests in _TestClass
           2 tests in _TestClass.__init__
           2 tests in _TestClass.get
           1 tests in _TestClass.square
        7 tests in 4 items.
        7 passed and 0 failed.
        Test passed.
        TestResults(failed=0, attempted=7)

    The aggregated number of tried examples and failed examples is
    also available via the `tries` and `failures` attributes:

        >>> runner.tries
        7
        >>> runner.failures
        0

    The comparison between expected outputs and actual outputs is done
    by an `OutputChecker`.  This comparison may be customized with a
    number of option flags; see the documentation for `testmod` for
    more information.  If the option flags are insufficient, then the
    comparison may also be customized by passing a subclass of
    `OutputChecker` to the constructor.

    The test runner's display output can be controlled in two ways.
    First, an output function (`out) can be passed to
    `TestRunner.run`; this function will be called with strings that
    should be displayed.  It defaults to `sys.stdout.write`.  If
    capturing the output is not sufficient, then the display output
    can be also customized by subclassing DocTestRunner, and
    overriding the methods `report_start`, `report_success`,
    `report_unexpected_exception`, and `report_failure`.
    u*iFicCsv|pt�|_|dkr0dtjk}n||_||_||_d|_d|_	i|_
t�|_dS(uc
        Create a new test runner.

        Optional keyword arg `checker` is the `OutputChecker` that
        should be used to compare the expected outputs and actual
        outputs of doctest examples.

        Optional keyword arg 'verbose' prints lots of stuff if true,
        only failures if false; by default, it's true iff '-v' is in
        sys.argv.

        Optional argument `optionflags` can be used to control how the
        test runner compares expected output to actual output, and how
        it displays failures.  See the documentation for `testmod` for
        more information.
        u-viN(
u
OutputCheckeru_checkeruNoneusysuargvu_verboseuoptionflagsuoriginal_optionflagsutriesufailuresu_name2ftu	_SpoofOutu_fakeout(uselfucheckeruverboseuoptionflags((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s						uDocTestRunner.__init__cCs_|jr[|jr=|dt|j�dt|j��q[|dt|j�d�ndS(u�
        Report that the test runner is about to process the given
        example.  (Only displays a message if verbose=True)
        uTrying:
uExpecting:
uExpecting nothing
N(u_verboseuwantu_indentusource(uselfuoututestuexample((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_start�s		(uDocTestRunner.report_startcCs|jr|d�ndS(ut
        Report that the given example ran successfully.  (Only
        displays a message if verbose=True)
        uok
N(u_verbose(uselfuoututestuexampleugot((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_success�s	uDocTestRunner.report_successcCs3||j||�|jj|||j��dS(u7
        Report that the given example failed.
        N(u_failure_headeru_checkeruoutput_differenceuoptionflags(uselfuoututestuexampleugot((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_failure�suDocTestRunner.report_failurecCs.||j||�dtt|���dS(uO
        Report that the given example raised an unexpected exception.
        uException raised:
N(u_failure_headeru_indentu_exception_traceback(uselfuoututestuexampleuexc_info((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_unexpected_exception�su)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrs|jdk	rJ|jdk	rJ|j|jd}nd}|jd|j||jf�n!|jd|jd|jf�|jd�|j}|jt|��dj|�S(Niu?uFile "%s", line %s, in %suLine %s, in %suFailed example:u
(	uDIVIDERufilenameulinenouNoneuappendunameusourceu_indentujoin(uselfutestuexampleuoutulinenousource((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_failure_header�s		!
	uDocTestRunner._failure_headercCsjd}}|j}td�\}}}	|jj}
x
t|j�D]�\}}|jt@of|dk}
||_|jr�xH|jj�D]4\}}|r�|j|O_q�|j|M_q�Wn|jt	@r�qDn|d7}|
s�|j
|||�nd|j|f}y<tt
|j|d|d�|j�|jj�d}Wn5tk
re�Yn!tj�}|jj�YnX|jj�}|jjd�|}|dkr�|
|j||j�r�|}q�n�tj|dd��d	}|
s|t|�7}n|jdkr)|	}n^|
|j||j�rJ|}n=|jt@r�|
t|j�t|�|j�r�|}q�n||kr�|
s=|j ||||�q=qD||kr�|
s�|j!||||�n|d7}qD||	kr%|
s|j"||||�n|d7}qDd
sDt$d|f��qDW||_|j%|||�t&||�S(u�
        Run the examples in `test`.  Write the outcome of each example
        with one of the `DocTestRunner.report_*` methods, using the
        writer function `out`.  `compileflags` is the set of compiler
        flags that should be used to execute examples.  Return a tuple
        `(f, t)`, where `t` is the number of examples tried, and `f`
        is the number of examples that failed.  The examples are run
        in the namespace `test.globs`.
        iiiu<doctest %s[%d]>usingleNiuunknown outcomei����F('uoptionflagsurangeu_checkerucheck_outputu	enumerateuexamplesuREPORT_ONLY_FIRST_FAILUREuoptionsuitemsuSKIPureport_startunameuexecucompileusourceuglobsudebuggeruset_continueuNoneuKeyboardInterruptusysuexc_infou_fakeoutugetvalueutruncateuwantu	tracebackuformat_exception_onlyu_exception_tracebackuexc_msguIGNORE_EXCEPTION_DETAILu_strip_exception_detailsureport_successureport_failureureport_unexpected_exceptionuFalseuAssertionErroru_DocTestRunner__record_outcomeuTestResults(uselfutestucompileflagsuoutufailuresutriesuoriginal_optionflagsuSUCCESSuFAILUREuBOOMuchecku
examplenumuexampleuquietu
optionflaguvalufilenameu	exceptionugotuoutcomeuexc_msg((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__run�s~
	
		




		
	


	uDocTestRunner.__runcCs^|jj|jd�\}}||||f|j|j<|j|7_|j|7_dS(u{
        Record the fact that the given DocTest (`test`) generated `f`
        failures out of `t` tried examples.
        iN(ii(u_name2ftugetunameufailuresutries(uselfutestufutuf2ut2((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__record_outcomeasuDocTestRunner.__record_outcomeu.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsy|jj|�}|re|jd�|jjkre|jjt|jd��}|jjdd�S|j
||�SdS(Nunameu
examplenumukeependsT(u%_DocTestRunner__LINECACHE_FILENAME_REumatchugrouputestunameuexamplesuintusourceu
splitlinesuTrueusave_linecache_getlines(uselfufilenameumodule_globalsumuexample((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__patched_linecache_getlinesns
!u*DocTestRunner.__patched_linecache_getlinesc	s~||_|dkr't|j�}ntj�|dkr��j��dksc�j�dkro�j}q���fdd�}n|j	t_tj
�}tj}t
��|_|jj�|jjt_tj|_|jt_tj}tjt_z|j|||�SWd�t_|t_tj|�|jt_|t_|ry|jj�ddl}d|_nXdS(uJ
        Run the examples in `test`, and display the results using the
        writer function `out`.

        The examples are run in the namespace `test.globs`.  If
        `clear_globs` is true (the default), then this namespace will
        be cleared after the test runs, to help with garbage
        collection.  If you would like to examine the namespace after
        the test completes, then use `clear_globs=False`.

        `compileflags` gives the set of flags that should be used by
        the Python compiler when running the examples.  If not
        specified, then it will default to the set of future-import
        flags that apply to `globs`.

        The output of each example is checked using
        `DocTestRunner.check_output`, and the results are formatted by
        the `DocTestRunner.report_*` methods.
        uutf-8cs,t|j�d���}�j|�dS(Nubackslashreplace(ustruencodeuwrite(us(uencodingusave_stdout(u,/opt/alt/python33/lib64/python3.3/doctest.pyuout�suDocTestRunner.run.<locals>.outNi(utestuNoneu_extract_future_flagsuglobsusysustdoutuencodinguloweruwriteu_fakeoutugettraceupdbu	set_traceu_OutputRedirectingPdbudebuggeruresetu	linecacheugetlinesusave_linecache_getlinesu*_DocTestRunner__patched_linecache_getlinesudisplayhooku__displayhook__u_DocTestRunner__runusettraceuclearubuiltinsu_(	uselfutestucompileflagsuoutuclear_globsu
save_traceusave_set_traceusave_displayhookubuiltins((uencodingusave_stdoutu,/opt/alt/python33/lib64/python3.3/doctest.pyurunvs<				
			
	
uDocTestRunner.runc
CsK|dkr|j}ng}g}g}d}}x�|jj�D]�}|\}\}	}
|	|
ksnt�||
7}||	7}|
dkr�|j|�qD|	dkr�|j||
f�qD|j|�qDW|ro|rtt|�d�|j�x|D]}td|�qWn|rott|�d�|j�x+|D] \}}td||f�qEWqon|r�t|j	�tt|�d�|j�x4|D])\}\}	}
td|	|
|f�q�Wn|rt|dt|j�d	�t||d
|d�n|r+td|d
�n|r>td�nt
||�S(u�
        Print a summary of all the test cases that have been run by
        this DocTestRunner, and return a tuple `(f, t)`, where `f` is
        the total number of failed examples, and `t` is the total
        number of tried examples.

        The optional `verbose` argument controls how detailed the
        summary is.  If the verbosity is not specified, then the
        DocTestRunner's verbosity is used.
        iuitems had no tests:u   uitems passed all tests:u %3d tests in %suitems had failures:u %3d of %3d in %sutests inuitems.u
passed andufailed.u***Test Failed***u	failures.uTest passed.N(uNoneu_verboseu_name2ftuitemsuAssertionErroruappenduprintulenusortuDIVIDERuTestResults(
uselfuverboseunotestsupassedufailedutotaltutotalfuxunameufututhingucount((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	summarize�sR








uDocTestRunner.summarizecCsv|j}xf|jj�D]U\}\}}||kr^||\}}||}||}n||f||<qWdS(N(u_name2ftuitems(uselfuotherudunameufutuf2ut2((u,/opt/alt/python33/lib64/python3.3/doctest.pyumerge�s	"

uDocTestRunner.mergeNT(u__name__u
__module__u__qualname__u__doc__uDIVIDERuNoneu__init__ureport_startureport_successureport_failureureport_unexpected_exceptionu_failure_headeru_DocTestRunner__runu_DocTestRunner__record_outcomeureucompileu%_DocTestRunner__LINECACHE_FILENAME_REu*_DocTestRunner__patched_linecache_getlinesuTrueurunu	summarizeumerge(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
DocTestRunnerPs7
$
z
I9cBsJ|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S(u
OutputCheckeru_
    A class used to check the whether the actual output from a doctest
    example matches the expected output.  `OutputChecker` defines two
    methods: `check_output`, which compares a given pair of outputs,
    and returns true if they match; and `output_difference`, which
    returns a string describing the differences between two outputs.
    cCst|jdd�d�S(u=
        Convert string to hex-escaped ASCII string.
        uASCIIubackslashreplace(ustruencode(uselfus((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_toAscii
suOutputChecker._toAsciicCs&|j|�}|j|�}||kr.d	S|t@sg||fd
krNd	S||fdkrgd	Sn|t@s�tjdtjt�d|�}tjdd|�}||kr�d	Sn|t@rdj	|j
��}dj	|j
��}||krd	Sn|t@r"t||�r"d	SndS(
u�
        Return True iff the actual output from an example (`got`)
        matches the expected output (`want`).  These strings are
        always considered to match if they are identical; but
        depending on what option flags the test runner is using,
        several non-exact match types are also possible.  See the
        documentation for `TestRunner` for more information about
        option flags.
        uTrue
u1
uFalse
u0
u(?m)^%s\s*?$uu
(?m)^\s*?$u T(uTrue
u1
(uFalse
u0
F(u_toAsciiuTrueuDONT_ACCEPT_TRUE_FOR_1uDONT_ACCEPT_BLANKLINEureusubuescapeuBLANKLINE_MARKERuNORMALIZE_WHITESPACEujoinusplituELLIPSISu_ellipsis_matchuFalse(uselfuwantugotuoptionflags((u,/opt/alt/python33/lib64/python3.3/doctest.pyucheck_outputs0



uOutputChecker.check_outputcCsL|ttBtB@sdS|t@r$dS|jd�dkoK|jd�dkS(Nu
iFT(uREPORT_UDIFFuREPORT_CDIFFuREPORT_NDIFFuFalseuTrueucount(uselfuwantugotuoptionflags((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_do_a_fancy_diffRs
uOutputChecker._do_a_fancy_diffc
Cs�|j}|t@s+tjdt|�}n|j|||�rf|jdd�}|jdd�}|t@r�t	j
||dd�}t|�dd�}d}n�|t@r�t	j
||dd�}t|�dd�}d}nR|t@r&t	jdt	j�}	t|	j||��}d	}nd
s8td��dd
�|D�}d|tdj|��S|r�|r�dt|�t|�fS|r�dt|�S|r�dt|�SdSdS(u�
        Return a string describing the differences between the
        expected output for a given example (`example`) and the actual
        output (`got`).  `optionflags` is the set of option flags used
        to compare `want` and `got`.
        u(?m)^[ ]*(?=
)ukeependsuniNu#unified diff with -expected +actualu-context diff with expected followed by actualucharjunkundiff with -expected +actualiuBad diff optioncSs g|]}|j�d�qS(u
(urstrip(u.0uline((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�s	u3OutputChecker.output_difference.<locals>.<listcomp>uDifferences (%s):
uuExpected:
%sGot:
%suExpected:
%sGot nothing
uExpected nothing
Got:
%suExpected nothing
Got nothing
T(uwantuDONT_ACCEPT_BLANKLINEureusubuBLANKLINE_MARKERu_do_a_fancy_diffu
splitlinesuTrueuREPORT_UDIFFudifflibuunified_diffulistuREPORT_CDIFFucontext_diffuREPORT_NDIFFuDifferuIS_CHARACTER_JUNKucompareuAssertionErroru_indentujoin(
uselfuexampleugotuoptionflagsuwantu
want_linesu	got_linesudiffukinduengine((u,/opt/alt/python33/lib64/python3.3/doctest.pyuoutput_differenceis8	

	
	
	uOutputChecker.output_differenceN(u__name__u
__module__u__qualname__u__doc__u_toAsciiucheck_outputu_do_a_fancy_diffuoutput_difference(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
OutputCheckers
?cBs2|EeZdZdZdd�Zdd�ZdS(uDocTestFailureu�A DocTest example has failed in debugging mode.

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - got: the actual output
    cCs||_||_||_dS(N(utestuexampleugot(uselfutestuexampleugot((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s		uDocTestFailure.__init__cCs
t|j�S(N(ustrutest(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__str__�suDocTestFailure.__str__N(u__name__u
__module__u__qualname__u__doc__u__init__u__str__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocTestFailure�s
cBs2|EeZdZdZdd�Zdd�ZdS(uUnexpectedExceptionu�A DocTest example has encountered an unexpected exception

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - exc_info: the exception info
    cCs||_||_||_dS(N(utestuexampleuexc_info(uselfutestuexampleuexc_info((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s		uUnexpectedException.__init__cCs
t|j�S(N(ustrutest(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__str__�suUnexpectedException.__str__N(u__name__u
__module__u__qualname__u__doc__u__init__u__str__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuUnexpectedException�s
cBsG|EeZdZdZddd	dd�Zdd�Zdd�ZdS(
uDebugRunneru�	Run doc tests but raise an exception as soon as there is a failure.

       If an unexpected exception occurs, an UnexpectedException is raised.
       It contains the test, the example, and the original exception:

         >>> runner = DebugRunner(verbose=False)
         >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
         ...                                    {}, 'foo', 'foo.py', 0)
         >>> try:
         ...     runner.run(test)
         ... except UnexpectedException as f:
         ...     failure = f

         >>> failure.test is test
         True

         >>> failure.example.want
         '42\n'

         >>> exc_info = failure.exc_info
         >>> raise exc_info[1] # Already has the traceback
         Traceback (most recent call last):
         ...
         KeyError

       We wrap the original exception to give the calling application
       access to the test and example information.

       If the output doesn't match, then a DocTestFailure is raised:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 1
         ...      >>> x
         ...      2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> try:
         ...    runner.run(test)
         ... except DocTestFailure as f:
         ...    failure = f

       DocTestFailure objects provide access to the test:

         >>> failure.test is test
         True

       As well as to the example:

         >>> failure.example.want
         '2\n'

       and the actual output:

         >>> failure.got
         '1\n'

       If a failure or error occurs, the globals are left intact:

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 1}

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      >>> raise KeyError
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         Traceback (most recent call last):
         ...
         doctest.UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 2}

       But the globals are cleared if there is no error:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         TestResults(failed=0, attempted=1)

         >>> test.globs
         {}

       cCs5tj||||d�}|r1|jj�n|S(NF(u
DocTestRunnerurunuFalseuglobsuclear(uselfutestucompileflagsuoutuclear_globsur((u,/opt/alt/python33/lib64/python3.3/doctest.pyurunsuDebugRunner.runcCst|||��dS(N(uUnexpectedException(uselfuoututestuexampleuexc_info((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_unexpected_exception su'DebugRunner.report_unexpected_exceptioncCst|||��dS(N(uDocTestFailure(uselfuoututestuexampleugot((u,/opt/alt/python33/lib64/python3.3/doctest.pyureport_failure#suDebugRunner.report_failureNT(	u__name__u
__module__u__qualname__u__doc__uNoneuTrueurunureport_unexpected_exceptionureport_failure(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDebugRunner�sYc	Cs|dkr!tjjd�}ntj|�sFtd|f��n|dkr^|j}ntd|�}	|r�t	d|d|�}
nt
d|d|�}
x3|	j||d|d|�D]}|
j|�q�W|r�|
j
�ntdkr�|
an
tj|
�t|
j|
j�S(	u*
m=None, name=None, globs=None, verbose=None, report=True,
       optionflags=0, extraglobs=None, raise_on_error=False,
       exclude_empty=False

    Test examples in docstrings in functions and classes reachable
    from module m (or the current module if m is not supplied), starting
    with m.__doc__.

    Also test examples reachable from dict m.__test__ if it exists and is
    not None.  m.__test__ maps names to functions, classes and strings;
    function and class docstrings are tested even if the name is private;
    strings are tested directly, as if they were docstrings.

    Return (#failures, #tests).

    See help(doctest) for an overview.

    Optional keyword arg "name" gives the name of the module; by default
    use m.__name__.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use m.__dict__.  A copy of this
    dict is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.  This is new in 2.4.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  This is new in 2.3.  Possible values (see the
    docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    u__main__utestmod: module required; %ru
exclude_emptyuverboseuoptionflagsuglobsu
extraglobsN(uNoneusysumodulesugetuinspectuismoduleu	TypeErroru__name__u
DocTestFinderuDebugRunneru
DocTestRunnerufindurunu	summarizeumasterumergeuTestResultsufailuresutries(umunameuglobsuverboseureportuoptionflagsu
extraglobsuraise_on_erroru
exclude_emptyufinderurunnerutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyutestmod/s$E%
	
cCsW|r|rtd��nt||||p1d�\}}|dkr^tjj|�}n|dkrsi}n|j�}|dk	r�|j|�nd|kr�d|d<n|	r�td|d|�}
nt	d|d|�}
|
j
||||d�}|
j|�|r"|
j�nt
dkr7|
a
n
t
j|
�t|
j|
j�S(	u


    Test examples in the given file.  Return (#failures, #tests).

    Optional keyword arg "module_relative" specifies how filenames
    should be interpreted:

      - If "module_relative" is True (the default), then "filename"
         specifies a module-relative path.  By default, this path is
         relative to the calling module's directory; but if the
         "package" argument is specified, then it is relative to that
         package.  To ensure os-independence, "filename" should use
         "/" characters to separate path segments, and should not
         be an absolute path (i.e., it may not begin with "/").

      - If "module_relative" is False, then "filename" specifies an
        os-specific path.  The path may be absolute or relative (to
        the current working directory).

    Optional keyword arg "name" gives the name of the test; by default
    use the file's basename.

    Optional keyword argument "package" is a Python package or the
    name of a Python package whose directory should be used as the
    base directory for a module relative filename.  If no package is
    specified, then the calling module's directory is used as the base
    directory for module relative filenames.  It is an error to
    specify "package" if "module_relative" is False.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use {}.  A copy of this dict
    is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  Possible values (see the docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Optional keyword arg "parser" specifies a DocTestParser (or
    subclass) that should be used to extract tests from the files.

    Optional keyword arg "encoding" specifies an encoding that should
    be used to convert the file to unicode.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    u8Package may only be specified for module-relative paths.uutf-8u__name__u__main__uverboseuoptionflagsiN(u
ValueErroru_load_testfileuNoneuosupathubasenameucopyuupdateuDebugRunneru
DocTestRunneruget_doctesturunu	summarizeumasterumergeuTestResultsufailuresutries(ufilenameumodule_relativeunameupackageuglobsuverboseureportuoptionflagsu
extraglobsuraise_on_erroruparseruencodingutexturunnerutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyutestfile�s0R
	


	
uNoNamec	Csdtd|dd�}td|d|�}x3|j||d|�D]}|j|d|�qCWdS(ur
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    uverboseurecurseuoptionflagsuglobsucompileflagsNF(u
DocTestFinderuFalseu
DocTestRunnerufindurun(	ufuglobsuverboseunameucompileflagsuoptionflagsufinderurunnerutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyurun_docstring_examplesscCs2|t@|kr"td|��nt}|a|S(u?Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    uOnly reporting flags allowed(uREPORTING_FLAGSu
ValueErroru_unittest_reportflags(uflagsuold((u,/opt/alt/python33/lib64/python3.3/doctest.pyuset_unittest_reportflags/s
cBs�|EeZdZdddddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZdd�ZdS(uDocTestCaseicCsAtjj|�||_||_||_||_||_dS(N(uunittestuTestCaseu__init__u_dt_optionflagsu_dt_checkeru_dt_testu	_dt_setUpu_dt_tearDown(uselfutestuoptionflagsusetUputearDownuchecker((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__Us				uDocTestCase.__init__cCs,|j}|jdk	r(|j|�ndS(N(u_dt_testu	_dt_setUpuNone(uselfutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyusetUp_s	uDocTestCase.setUpcCs9|j}|jdk	r(|j|�n|jj�dS(N(u_dt_testu_dt_tearDownuNoneuglobsuclear(uselfutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyutearDownes	uDocTestCase.tearDowncCs�|j}tj}t�}|j}|t@s;|tO}ntd|d|jdd�}z5dd|_
|j|d|jdd�\}}Wd|t_X|r�|j
|j|j����ndS(	Nuoptionflagsucheckeruverboseu-iFuoutuclear_globsF(u_dt_testusysustdoutuStringIOu_dt_optionflagsuREPORTING_FLAGSu_unittest_reportflagsu
DocTestRunneru_dt_checkeruFalseuDIVIDERurunuwriteufailureExceptionuformat_failureugetvalue(uselfutestuoldunewuoptionflagsurunnerufailuresutries((u,/opt/alt/python33/lib64/python3.3/doctest.pyurunTestms				


"
uDocTestCase.runTestcCsp|j}|jdkr!d}n
d|j}dj|jjd�dd��}d|j|j|||fS(Nuunknown line numberu%su.iu:Failed doctest test for %s
  File "%s", line %s, in %s

%si����(u_dt_testulinenouNoneujoinunameusplitufilename(uselfuerrutestulinenoulname((u,/opt/alt/python33/lib64/python3.3/doctest.pyuformat_failure�s		
%uDocTestCase.format_failurecCsO|j�td|jd|jdd�}|j|jdd�|j�dS(u�Run the test case without results and without catching exceptions

           The unit test framework includes a debug method on test cases
           and test suites to support post-mortem debugging.  The test code
           is run in such a way that errors are not caught.  This way a
           caller can catch the errors and initiate post-mortem debugging.

           The DocTestCase provides a debug method that raises
           UnexpectedException errors if there is an unexpected
           exception:

             >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
             ...                {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)
             >>> try:
             ...     case.debug()
             ... except UnexpectedException as f:
             ...     failure = f

           The UnexpectedException contains the test, the example, and
           the original exception:

             >>> failure.test is test
             True

             >>> failure.example.want
             '42\n'

             >>> exc_info = failure.exc_info
             >>> raise exc_info[1] # Already has the traceback
             Traceback (most recent call last):
             ...
             KeyError

           If the output doesn't match, then a DocTestFailure is raised:

             >>> test = DocTestParser().get_doctest('''
             ...      >>> x = 1
             ...      >>> x
             ...      2
             ...      ''', {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)

             >>> try:
             ...    case.debug()
             ... except DocTestFailure as f:
             ...    failure = f

           DocTestFailure objects provide access to the test:

             >>> failure.test is test
             True

           As well as to the example:

             >>> failure.example.want
             '2\n'

           and the actual output:

             >>> failure.got
             '1\n'

           uoptionflagsucheckeruverboseuclear_globsNF(usetUpuDebugRunneru_dt_optionflagsu_dt_checkeruFalseurunu_dt_testutearDown(uselfurunner((u,/opt/alt/python33/lib64/python3.3/doctest.pyudebug�s
B
uDocTestCase.debugcCs
|jjS(N(u_dt_testuname(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyuid�suDocTestCase.idcCstt|�t|�k	rtS|j|jkos|j|jkos|j|jkos|j|jkos|j|jkS(N(utypeuNotImplementedu_dt_testu_dt_optionflagsu	_dt_setUpu_dt_tearDownu_dt_checker(uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__eq__�suDocTestCase.__eq__cCs||kS(N((uselfuother((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__ne__�suDocTestCase.__ne__cCs"t|j|j|j|jf�S(N(uhashu_dt_optionflagsu	_dt_setUpu_dt_tearDownu_dt_checker(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__hash__�suDocTestCase.__hash__cCs:|jjjd�}d|ddj|dd��fS(Nu.u%s (%s)ii����i����(u_dt_testunameusplitujoin(uselfuname((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__repr__�suDocTestCase.__repr__cCsd|jjS(Nu	Doctest: (u_dt_testuname(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyushortDescription�suDocTestCase.shortDescriptionN(u__name__u
__module__u__qualname__uNoneu__init__usetUputearDownurunTestuformat_failureudebuguidu__eq__u__ne__u__hash__u__repr__u__str__ushortDescription(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocTestCaseSs		H
uDocTestCasecBsJ|EeZdZdd�Zdd�Zdd�Zdd�ZeZd	S(
uSkipDocTestCasecCs||_tj|d�dS(N(umoduleuDocTestCaseu__init__uNone(uselfumodule((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__�s	uSkipDocTestCase.__init__cCs|jd�dS(Nu-DocTestSuite will not work with -O2 and above(uskipTest(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyusetUp�suSkipDocTestCase.setUpcCsdS(N((uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	test_skip�suSkipDocTestCase.test_skipcCsd|jjS(NuSkipping tests from %s(umoduleu__name__(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyushortDescription	su SkipDocTestCase.shortDescriptionN(u__name__u
__module__u__qualname__u__init__usetUpu	test_skipushortDescriptionu__str__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuSkipDocTestCase�s
uSkipDocTestCasec	Ks6|dkrt�}nt|�}|j|d|d|�}|r{tjjdkr{tj�}|j	t
|��|S|s�t|d��n|j�tj�}x�|D]~}t
|j�dkr�q�n|js|j}|dd�dkr|dd
�}n||_n|j	t||��q�W|S(u
    Convert doctest tests for a module to a unittest test suite.

    This converts each documentation string in a module that
    contains doctest tests to a unittest test case.  If any of the
    tests in a doc string fail, then the test case fails.  An exception
    is raised showing the name of the file containing the test and a
    (sometimes approximate) line number.

    The `module` argument provides the module to be tested.  The argument
    can be either a module or a module name.

    If no argument is given, the calling module is used.

    A number of options may be provided as keyword arguments:

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
       A set of doctest option flags expressed as an integer.
    uglobsu
extraglobsiuhas no docstringsiiNu.pycu.pyoii����(u.pycu.pyoi����(uNoneu
DocTestFinderu_normalize_moduleufindusysuflagsuoptimizeuunittestu	TestSuiteuaddTestuSkipDocTestCaseu
ValueErrorusortulenuexamplesufilenameu__file__uDocTestCase(	umoduleuglobsu
extraglobsutest_finderuoptionsutestsusuiteutestufilename((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocTestSuite	s,%

		cBs>|EeZdZdd�Zdd�ZeZdd�ZdS(uDocFileCasecCsdj|jjjd��S(Nu_u.(ujoinu_dt_testunameusplit(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyuidR	suDocFileCase.idcCs
|jjS(N(u_dt_testufilename(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__repr__U	suDocFileCase.__repr__cCsd|jj|jj|fS(Nu2Failed doctest test for %s
  File "%s", line 0

%s(u_dt_testunameufilename(uselfuerr((u,/opt/alt/python33/lib64/python3.3/doctest.pyuformat_failureY	suDocFileCase.format_failureN(u__name__u
__module__u__qualname__uidu__repr__u__str__uformat_failure(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocFileCaseP	suDocFileCasec
Ks�|dkri}n|j�}|r=|r=td��nt||||pRd�\}}d|krw||d<ntjj|�}|j||||d�}	t|	|�S(Nu8Package may only be specified for module-relative paths.uutf-8u__file__i(	uNoneucopyu
ValueErroru_load_testfileuosupathubasenameuget_doctestuDocFileCase(
upathumodule_relativeupackageuglobsuparseruencodinguoptionsudocunameutest((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocFileTest^	s	

uDocFileTestcOsetj�}|jdd�r:t|jd��|d<nx$|D]}|jt||��qAW|S(u�A unittest suite for one or more doctest files.

    The path to each doctest file is given as a string; the
    interpretation of that string depends on the keyword argument
    "module_relative".

    A number of options may be provided as keyword arguments:

    module_relative
      If "module_relative" is True, then the given file paths are
      interpreted as os-independent module-relative paths.  By
      default, these paths are relative to the calling module's
      directory; but if the "package" argument is specified, then
      they are relative to that package.  To ensure os-independence,
      "filename" should use "/" characters to separate path
      segments, and may not be an absolute path (i.e., it may not
      begin with "/").

      If "module_relative" is False, then the given file paths are
      interpreted as os-specific paths.  These paths may be absolute
      or relative (to the current working directory).

    package
      A Python package or the name of a Python package whose directory
      should be used as the base directory for module relative paths.
      If "package" is not specified, then the calling module's
      directory is used as the base directory for module relative
      filenames.  It is an error to specify "package" if
      "module_relative" is False.

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
      A set of doctest option flags expressed as an integer.

    parser
      A DocTestParser (or subclass) that should be used to extract
      tests from the files.

    encoding
      An encoding that will be used to convert the files to unicode.
    umodule_relativeupackageT(uunittestu	TestSuiteugetuTrueu_normalize_moduleuaddTestuDocFileTest(upathsukwusuiteupath((u,/opt/alt/python33/lib64/python3.3/doctest.pyuDocFileSuitex	s8
cCs$g}x�t�j|�D]�}t|t�r�|j|jdd
��|j}|r�|jd�|dd�|jd�dd�D�7}q�q|dd�|jd�dd�D�7}qWx$|r�|d
dkr�|j�q�Wx'|r|d	dkr|jd	�q�Wdj	|�dS(uwExtract script from text with examples.

       Converts text with examples to a Python script.  Example input is
       converted to regular code.  Example output and all other words
       are converted to comments:

       >>> text = '''
       ...       Here are examples of simple math.
       ...
       ...           Python has super accurate integer addition
       ...
       ...           >>> 2 + 2
       ...           5
       ...
       ...           And very friendly error messages:
       ...
       ...           >>> 1/0
       ...           To Infinity
       ...           And
       ...           Beyond
       ...
       ...           You can use logic if you want:
       ...
       ...           >>> if 0:
       ...           ...    blah
       ...           ...    blah
       ...           ...
       ...
       ...           Ho hum
       ...           '''

       >>> print(script_from_examples(text))
       # Here are examples of simple math.
       #
       #     Python has super accurate integer addition
       #
       2 + 2
       # Expected:
       ## 5
       #
       #     And very friendly error messages:
       #
       1/0
       # Expected:
       ## To Infinity
       ## And
       ## Beyond
       #
       #     You can use logic if you want:
       #
       if 0:
          blah
          blah
       #
       #     Ho hum
       <BLANKLINE>
       Niu# Expected:cSsg|]}d|�qS(u## ((u.0ul((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>
s	u(script_from_examples.<locals>.<listcomp>u
cSsg|]}t|��qS((u
_comment_line(u.0ul((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>
s	u#ii����i����i����i����(
u
DocTestParseruparseu
isinstanceuExampleuappendusourceuwantusplitupopujoin(usuoutputupieceuwant((u,/opt/alt/python33/lib64/python3.3/doctest.pyuscript_from_examples�	s:	
0"cslt|�}t�j|�}�fdd�|D�}|sOt�d��n|d}t|j�}|S(uExtract the test sources from a doctest docstring as a script.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the doc string with tests to be debugged.
    cs%g|]}|j�kr|�qS((uname(u.0ut(uname(u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>
s	utestsource.<locals>.<listcomp>unot found in testsi(u_normalize_moduleu
DocTestFinderufindu
ValueErroruscript_from_examplesu	docstring(umoduleunameutestsutestutestsrc((unameu,/opt/alt/python33/lib64/python3.3/doctest.pyu
testsource
s
cCs t|�}t|||�dS(u4Debug a single doctest docstring, in argument `src`'N(uscript_from_examplesudebug_script(usrcupmuglobsutestsrc((u,/opt/alt/python33/lib64/python3.3/doctest.pyu	debug_src#
sc
Cs�ddl}|r!|j�}ni}|r�yt|||�Wq�ttj�d�|jdd�}|j�|j	dtj�d�Yq�Xn#|jdd�jd|||�dS(u7Debug a test script.  `src` is the script, as a string.iNiunosigintiuexec(%r)T(updbucopyuexecuprintusysuexc_infouPdbuTrueuresetuinteractionuNoneurun(usrcupmuglobsupdbup((u,/opt/alt/python33/lib64/python3.3/doctest.pyudebug_script(
s
"udebug_scriptcCs2t|�}t||�}t|||j�dS(u�Debug a single doctest docstring.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the docstring with tests to be debugged.
    N(u_normalize_moduleu
testsourceudebug_scriptu__dict__(umoduleunameupmutestsrc((u,/opt/alt/python33/lib64/python3.3/doctest.pyudebug<
scBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	u
_TestClassu�
    A pointless class, for sanity-checking of docstring testing.

    Methods:
        square()
        get()

    >>> _TestClass(13).get() + _TestClass(-12).get()
    1
    >>> hex(_TestClass(13).square().get())
    '0xa9'
    cCs
||_dS(u�val -> _TestClass object with associated value val.

        >>> t = _TestClass(123)
        >>> print(t.get())
        123
        N(uval(uselfuval((u,/opt/alt/python33/lib64/python3.3/doctest.pyu__init__X
su_TestClass.__init__cCs|jd|_|S(uosquare() -> square TestClass's associated value

        >>> _TestClass(13).square().get()
        169
        i(uval(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyusquareb
su_TestClass.squarecCs|jS(u~get() -> return TestClass's associated value.

        >>> x = _TestClass(-42)
        >>> print(x.get())
        -42
        (uval(uself((u,/opt/alt/python33/lib64/python3.3/doctest.pyugetl
su_TestClass.getN(u__name__u
__module__u__qualname__u__doc__u__init__usquareuget(u
__locals__((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
_TestClassJ
s

u
_TestClassu�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      ustringu�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    ubool-int equivalenceu�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            ublank linesu�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            uellipsisu�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            uwhitespace normalizationcCs&dd�tjdd�D�}|s�tjjtjd�}dt�kritjj|�\}}ntdj|��dSx�|D]�}|j	d�r�tjj
|�\}}tjjd|�t|dd��}tjd=t
|�\}}nt|d
d�\}}|r�dSq�WdS(
NcSs,g|]"}|r|ddkr|�qS(iu-((u.0uarg((u,/opt/alt/python33/lib64/python3.3/doctest.pyu
<listcomp>�
s	u_test.<locals>.<listcomp>iiu
__loader__uusage: {0} [-v] file ...iu.pyiumodule_relativei����F(usysuargvuosupathubasenameuglobalsusplitextuprintuformatuendswithusplituinsertu
__import__utestmodutestfileuFalse(u	testfilesunameu_ufilenameudirnameumufailures((u,/opt/alt/python33/lib64/python3.3/doctest.pyu_test�
s$ 

u_testu__main__(Ru__doc__u
__docformat__u__all__u
__future__udifflibuinspectu	linecacheuosupdbureusysu	tracebackuunittestuiouStringIOucollectionsu
namedtupleuTestResultsuOPTIONFLAGS_BY_NAMEuregister_optionflaguDONT_ACCEPT_TRUE_FOR_1uDONT_ACCEPT_BLANKLINEuNORMALIZE_WHITESPACEuELLIPSISuSKIPuIGNORE_EXCEPTION_DETAILuCOMPARISON_FLAGSuREPORT_UDIFFuREPORT_CDIFFuREPORT_NDIFFuREPORT_ONLY_FIRST_FAILUREuREPORTING_FLAGSuBLANKLINE_MARKERuELLIPSIS_MARKERu_extract_future_flagsu_normalize_moduleu_load_testfileu_indentu_exception_tracebacku	_SpoofOutu_ellipsis_matchu
_comment_lineu_strip_exception_detailsuPdbu_OutputRedirectingPdbu_module_relative_pathuExampleuDocTestu
DocTestParseru
DocTestFinderu
DocTestRunneru
OutputCheckeru	ExceptionuDocTestFailureuUnexpectedExceptionuDebugRunneruNoneumasteruTrueuFalseutestmodutestfileurun_docstring_examplesu_unittest_reportflagsuset_unittest_reportflagsuTestCaseuDocTestCaseuSkipDocTestCaseuDocTestSuiteuDocFileCaseuDocFileTestuDocFileSuiteuscript_from_examplesu
testsourceu	debug_srcudebug_scriptudebugu
_TestClassu__test__u_testu__name__uexit(((u,/opt/alt/python33/lib64/python3.3/doctest.pyu<module>.s�	1%$GM��2���n	f	x$�I	IR,
		


?>