Your IP : 216.73.216.213


Current Path : /opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyo

�
�mYc@`s�dZddlmZmZmZddlZddlZddlmZddlm	Z	ddlm
Z
d�Zd�Zd	e
fd
��YZddd��YZd
�Zd�Zd�Zd�Zd�ZejZdS(sD
support for presenting detailed information in failing assertions.
i(tabsolute_importtdivisiontprint_functionN(tutil(trewrite(ttruncatecC`sD|jd�}|jdddddddd
dddd
d�dS(Ntdebugconfigs--asserttactiontstoretdestt
assertmodetchoicesRtplaintdefaulttmetavartMODEthelps4Control assertion debugging tools.  'plain'
                            performs no assertion debugging.  'rewrite'
                            (the default) rewrites assert statements in
                            test modules on import to provide assert
                            expression information.(RR(tgetgroupt	addoption(tparsertgroup((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytpytest_addoption
scG`s�xA|D]9}t|t�sd}t|jt|����qqWx6tjD]"}t|tj�rN|}PqNqNWt	�}|j
|�dS(s�Register one or more module names to be rewritten on import.

    This function will make sure that this module or all modules inside
    the package will get their assert statements rewritten.
    Thus you should make sure to call this before the module is
    actually imported, usually in your __init__.py if you are a plugin
    using a package.

    :raise TypeError: if the given module names are not strings.
    s/expected module names as *args, got {0} insteadN(t
isinstancetstrt	TypeErrortformattreprtsyst	meta_pathRtAssertionRewritingHooktDummyRewriteHooktmark_rewrite(tnamestnametmsgthookt
importhook((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytregister_assert_rewrites
"	RcB`seZdZd�ZRS(s3A no-op import hook for when rewriting is disabled.cG`sdS(N((tselfR ((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyR8s(t__name__t
__module__t__doc__R(((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyR5stAssertionStatecB`seZdZd�ZRS(sState for the assertion plugin.cC`s.||_|jjjd�|_d|_dS(Nt	assertion(tmodettracetroottgettNoneR#(R&tconfigR,((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyt__init__?s	(R'R(R)R2(((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyR*<sc`s�tjjd�s%tjd d
kr4td��nt�d��_tj���j_	}tj
jd|��jjd��fd	�}�j
|�|S(s?Try to install the rewrite hook, raise SystemError if it fails.tjavaiiiisrewrite not supportedRsinstalled rewrite import hookc`s>�jj}|dk	r:|tjkr:tjj|�ndS(N(t_assertstateR#R0RRtremove(R#(R1(sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytundoRs(iii(Rtplatformt
startswithtversion_infotSystemErrorR*R4RRR#RtinsertR-tadd_cleanup(R1R#R6((R1sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytinstall_importhookEs
cC`sDt|jdd�}|r@|jdk	r@|jj|�q@ndS(NR4(tgetattrR1R0R#tset_session(tsessiontassertstate((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytpytest_collection[sc`s�fd�}|t_dS(s�Setup the pytest_assertrepr_compare hook

    The newinterpret and rewrite modules will use util._reprcompare if
    it exists to use custom reporting via the
    pytest_assertrepr_compare hook.  This sets up this custom
    comparison for the test.
    c	`s��jjd�jd|d|d|�}x�|D]�}|r1tj|��}g|D]}|jdd�^qV}tjjd�j	|�}�jj
d�d	kr�|jd
d�}n|Sq1WdS(
sICall the pytest_assertrepr_compare hook and prepare the result

        This uses the first result from the hook and then ensures the
        following:
        * Overly verbose explanations are truncated unless configured otherwise
          (eg. if running in verbose mode).
        * Embedded newlines are escaped to help util.format_explanation()
          later.
        * If the rewrite mode is used embedded %-characters are replaced
          to protect later % formatting.

        The result can be formatted by util.format_explanation() for
        pretty printing.
        R1toptlefttrights
s\ns
~R
Rt%s%%N(tihooktpytest_assertrepr_compareR1Rttruncate_if_requiredtreplacetpytbuiltint_totexttjointgetvalue(RCRDREthook_resulttnew_expltlinetres(titem(sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytcallbinreprms
%N(Rt_reprcompare(RTRU((RTsK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytpytest_runtest_setupescC`s
dt_dS(N(R0RRV(RT((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytpytest_runtest_teardown�scC`sDt|jdd�}|r@|jdk	r@|jjd�q@ndS(NR4(R>R1R0R#R?(R@RA((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pytpytest_sessionfinish�s((R)t
__future__RRRRKRt_pytest.assertionRRRRR%tobjectRR*R=RBRWRXRYtassertrepr_compareRH(((sK/opt/alt/python27/lib/python2.7/site-packages/_pytest/assertion/__init__.pyt<module>s 					
	$