Your IP : 18.219.12.88


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

�
��f1c@s�dddddddddd	d
ddf
Zd
ZddlZddlZddlZddlmZefZdej	kr�ddl
Z
ee
jjfZne
ZeZdd�Zdd�ZGdd�de�Zeej�efZedd�Zedd�Zdd�Zdd�Zd d!�Zd"d#�Zed$d%�Z d&d'�Z!d(d)�Z"Gd*d+�d+e�Z#Gd,d-�d-e�Z$e$�Z%e%j&Z&e%j'Z(e%j)Z*d.d/�Z+e,d0d1d2d3d4d5d6d7g�Z-d8d9�Z.Gd:d;�d;e/�Z0d<d=�Z1Gd>d?�d?e�Z2Gd@d	�d	e2�Z3dAdB�Z4GdCdD�dDe2�Z5GdEd�de5e3�Z6dFdG�Z7dHdI�Z8dJdK�Z9GdLdM�dMe�Z:dNdO�Z;e&e<ee<e<e<dPdQ�Z=e<ee<e<e<dRdS�Z>e&e<ee<e<e<dTd�Z?GdUdV�dVe�Z@dWdX�ZAdYdZ�ZBe=e?_e@e?_Ce>e?_DeBe?_Ed[e?_Fd\ZGd]ZHd^jId_d`�eHjJ�D��ZKd^jIdad`�eHjJ�D��ZLe,dbd`�dcdddedfdgdhdidjdkdldmdndodpdqdrdsgD��ZMdtdu�ZNe,dvd`�d^jIeGeHeKeLg�jJ�D��ZOeOeMBZPe,dwdxdydzd{d|d}g�ZQid~d�d�6d�d�d�6d�d�d�6ZRieSd�6eSd�6eSd�6eSd�6d�d�6ed�6dd�6ed�6d�d�6d�d�6e
d�6d�d�6ZTd�d��ZUd�d��ZVd�d��ZWieUd�6eVd�6eWd�6ZXd�d��ZYGd�d��d�e�ZZGd�d
�d
eZe3�Z[Gd�d�deZe6�Z\Gd�d��d�e�Z]Gd�d��d�e�Z^e^�Z_d�d��Z`Gd�d��d�ea�Zbebd�e�Zceee<e<d�d�Zdd�d��Zed�d��ZfGd�d��d�e�Zgeed�ee_jh�fZie<aje<d�d�d�ZkGd�d�de6�ZldS(�uMocku	MagicMockupatchusentineluDEFAULTuANYucallucreate_autospecu
FILTER_DIRuNonCallableMockuNonCallableMagicMocku	mock_openuPropertyMocku1.0iN(uwrapsujavacCstt|�t�S(N(u
issubclassutypeuNonCallableMock(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_is_instance_mock.su_is_instance_mockcCs+t|t�p*t|t�o*t|t�S(N(u
isinstanceuBaseExceptionsutypeu
issubclass(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_is_exception4su
_is_exceptioncBs|EeZdZdgZdS(u_slotteduaN(u__name__u
__module__u__qualname__u	__slots__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_slotted;su_slottedcCsIt|t�rE|rEy
|j}Wntk
r;dSYnXd}n8t|t�s}y
|j}Wq}tk
rydSYq}Xnytj|�}Wnt	k
r�dSYnX|\}}}}}}	}
t
|dd�dk	r�|dd�}n|r|dd�}ntj||||||	|
ddd��}|dd�|fS(Nu__self__iuformatvaluecSsdS(Nu((uvalue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>esu_getsignature.<locals>.<lambda>Ti����(
u
isinstanceutypeu__init__uAttributeErroruTrueu
FunctionTypesu__call__uinspectugetfullargspecu	TypeErrorugetattruNoneu
formatargspec(ufuncu	skipfirstuinstanceuargspecuregargsuvarargsuvarkwudefaultsukwonlyu	kwonlydefuannu	signature((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_getsignatureEs0

		


	u
_getsignaturecCswt|�sdSt|||�}|dkr2dS|\}}d|}t|i�}t||�|t|�_dS(Nulambda _mock_self, %s: None(u	_callableu
_getsignatureuNoneuevalu_copy_func_detailsutypeu_mock_check_sig(ufuncumocku	skipfirstuinstanceuresultu	signatureusrcuchecksig((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_check_signatureis

u_check_signaturecCs@|j|_|j|_|j|_|j|_|j|_dS(N(u__name__u__doc__u
__module__u__defaults__u__kwdefaults__(ufuncufuncopy((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_copy_func_detailszs
u_copy_func_detailscCs3t|t�rdSt|dd�dk	r/dSdS(Nu__call__TF(u
isinstanceutypeuTrueugetattruNoneuFalse(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_callable�s
u	_callablecCst|�ttfkS(N(utypeulistutuple(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_is_list�su_is_listcCs`t|t�s%t|dd�dk	Sx4|f|jD]"}|jjd�dk	r6dSq6WdS(utGiven an object, return True if the object is callable.
    For classes, return True if instances would be callable.u__call__NTF(	u
isinstanceutypeugetattruNoneu__mro__u__dict__ugetuTrueuFalse(uobjubase((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_instance_callable�su_instance_callablecCs�t|�sdSt|t�}t|||�}|dkrAdS|\}}d|}t|i�}t||�|j}	|	j�s�d}	ni|d6|d6}
d|	}t	||
�|
|	}t
||�|S(Nulambda %s: Noneufuncopyu
_checksig_umockuYdef %s(*args, **kwargs):
    _checksig_(*args, **kwargs)
    return mock(*args, **kwargs)(u	_callableu
isinstanceutypeu
_getsignatureuNoneuevalu_copy_func_detailsu__name__uisidentifieruexecu_setup_func(umockuoriginaluinstanceu	skipfirsturesultu	signatureufuncusrcuchecksigunameucontextufuncopy((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_set_signature�s&

		



u_set_signaturecs��_t��sdS�fdd�}�fdd�}�fdd�}�fdd�}��fd	d
�}d�_d�_d�_t��_t��_	t��_
�j�_�j�_�j
�_
|�_|�_|�_|�_|�_��_dS(
Ncs�j||�S(N(uassert_called_with(uargsukwargs(umock(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_called_with�su'_setup_func.<locals>.assert_called_withcs�j||�S(N(uassert_called_once_with(uargsukwargs(umock(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_called_once_with�su,_setup_func.<locals>.assert_called_once_withcs�j||�S(N(uassert_has_calls(uargsukwargs(umock(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_has_calls�su%_setup_func.<locals>.assert_has_callscs�j||�S(N(uassert_any_call(uargsukwargs(umock(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_any_call�su$_setup_func.<locals>.assert_any_callcsTt��_t��_�j��j}t|�rP|�k	rP|j�ndS(N(u	_CallListumethod_callsu
mock_callsu
reset_mockureturn_valueu_is_instance_mock(uret(ufuncopyumock(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
reset_mock�s
	u_setup_func.<locals>.reset_mockiF(umocku_is_instance_mockuFalseucalledu
call_countuNoneu	call_argsu	_CallListucall_args_listumethod_callsu
mock_callsureturn_valueuside_effectu_mock_childrenuassert_called_withuassert_called_once_withuassert_has_callsuassert_any_callu
reset_mocku_mock_delegate(ufuncopyumockuassert_called_withuassert_called_once_withuassert_has_callsuassert_any_callu
reset_mock((ufuncopyumocku2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_setup_func�s.									u_setup_funccCsd|dd�|kS(Nu__%s__ii����((uname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_is_magic�su	_is_magiccBs2|EeZdZdZdd�Zdd�ZdS(u_SentinelObjectu!A unique, named, sentinel object.cCs
||_dS(N(uname(uselfuname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�su_SentinelObject.__init__cCsd|jS(Nusentinel.%s(uname(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__repr__�su_SentinelObject.__repr__N(u__name__u
__module__u__qualname__u__doc__u__init__u__repr__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_SentinelObject�su_SentinelObjectcBs2|EeZdZdZdd�Zdd�ZdS(u	_SentineluAAccess attributes to return a named object, usable as a sentinel.cCs
i|_dS(N(u
_sentinels(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�su_Sentinel.__init__cCs.|dkrt�n|jj|t|��S(Nu	__bases__(uAttributeErroru
_sentinelsu
setdefaultu_SentinelObject(uselfuname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__getattr__�s	u_Sentinel.__getattr__N(u__name__u
__module__u__qualname__u__doc__u__init__u__getattr__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_Sentinel�su	_SentinelcCs2t|�ttttfkr.t|�|�S|S(N(utypeudictulistutupleuset(uvalue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_copysu_copyureturn_valueu_mock_return_valueuside_effectu_mock_side_effectu_mock_parentu_mock_new_parentu
_mock_nameu_mock_new_namecCsHtj|�d|}||dd�}||dd�}t||�S(Nu_mock_cSs/|j}|dkr"t||�St||�S(N(u_mock_delegateuNoneugetattr(uselfunameu	_the_nameusig((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_gets	
u"_delegating_property.<locals>._getcSs9|j}|dkr%||j|<nt|||�dS(N(u_mock_delegateuNoneu__dict__usetattr(uselfuvalueunameu	_the_nameusig((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_set#s	u"_delegating_property.<locals>._set(u_allowed_namesuadduproperty(unameu	_the_nameu_getu_set((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_delegating_propertys


u_delegating_propertycBs,|EeZdZdd�Zdd�ZdS(u	_CallListcCs�t|t�stj||�St|�}t|�}||krGdSxCtd||d�D]*}||||�}||kr_dSq_WdS(NiiFT(u
isinstanceulistu__contains__ulenuFalseurangeuTrue(uselfuvalueu	len_valueulen_selfuiusub_list((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__contains__0su_CallList.__contains__cCstjt|��S(N(upprintupformatulist(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__repr__>su_CallList.__repr__N(u__name__u
__module__u__qualname__u__contains__u__repr__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_CallList.su	_CallListcCs�t|�sdS|js@|js@|jdk	s@|jdk	rDdS|}x)|dk	ru||kridS|j}qMW|r�||_||_n|r�||_||_ndS(NFT(u_is_instance_mockuFalseu
_mock_nameu_mock_new_nameu_mock_parentuNoneu_mock_new_parentuTrue(uparentuvalueunameunew_nameu_parent((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_check_and_set_parentBs$
		u_check_and_set_parentcBs,|EeZdZeZdZdd�ZdS(uBasecOsdS(N((uselfuargsukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init___su
Base.__init__N(u__name__u
__module__u__qualname__uDEFAULTu_mock_return_valueuNoneu_mock_side_effectu__init__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuBase\suBasec
Bs�|EeZdZdZdd�Zd9d9d9d9d9d9dd9dd�Zdd�Zd:d	d
�Z	dd�Z
d
d�Zdd�ZdZ
eeee
�Zedd��Zed�Zed�Zed�Zed�Zed�Zdd�Zdd�Zeee�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z d+d,�Z!d-d.�Z"d/d0�Z#d1d2�Z$d:d3d4�Z%d5d6�Z&d7d8�Z'd9S(;uNonCallableMocku A non-callable version of `Mock`cOs5t|j|fi|jd6�}tj|�}|S(Nu__doc__(utypeu__name__u__doc__uobjectu__new__(uclsuargsukwunewuinstance((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__new__gs"uNonCallableMock.__new__uc	Ks|dkr|}n|j}
||
d<||
d<||
d<||
d<|dk	ra|}d}n|j||�i|
d<||
d<d|
d<d|
d<d|
d	<d
|
d<t�|
d<t�|
d
<t�|
d<|	r�|j|	�ntt|�j	||||||�dS(Nu_mock_parentu
_mock_nameu_mock_new_nameu_mock_new_parentu_mock_childrenu_mock_wrapsu_mock_delegateu_mock_calledu_mock_call_argsiu_mock_call_countu_mock_call_args_listu_mock_mock_callsumethod_callsTF(
uNoneu__dict__uTrueu_mock_add_specuFalseu	_CallListuconfigure_mocku_safe_superuNonCallableMocku__init__(uselfuspecuwrapsunameuspec_setuparentu_spec_stateu	_new_nameu_new_parentukwargsu__dict__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__ps2		



	








uNonCallableMock.__init__cCs8d|_d|_d|_d|_t|||�dS(u�
        Attach a mock as an attribute of this one, replacing its name and
        parent. Calls to the attached mock will be recorded in the
        `method_calls` and `mock_calls` attributes of this one.uN(uNoneu_mock_parentu_mock_new_parentu
_mock_nameu_mock_new_nameusetattr(uselfumocku	attribute((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuattach_mock�s
				uNonCallableMock.attach_mockcCs|j||�dS(u�Add a spec to a mock. `spec` can either be an object or a
        list of strings. Only attributes on the `spec` can be fetched as
        attributes from the mock.

        If `spec_set` is True then only attributes on the spec can be set.N(u_mock_add_spec(uselfuspecuspec_set((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
mock_add_spec�suNonCallableMock.mock_add_speccCs}d}|dk	rRt|�rRt|t�r7|}nt|�}t|�}n|j}||d<||d<||d<dS(Nu_spec_classu	_spec_setu
_mock_methods(uNoneu_is_listu
isinstanceutypeu
_get_classudiru__dict__(uselfuspecuspec_setu_spec_classu__dict__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_mock_add_spec�s		

uNonCallableMock._mock_add_speccCs[|j}|jdk	r'|jj}n|tkrW|jd|dd�}||_n|S(Nu_new_parentu	_new_nameu()(u_mock_return_valueu_mock_delegateuNoneureturn_valueuDEFAULTu_get_child_mock(uselfuret((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__get_return_value�s		u"NonCallableMock.__get_return_valuecCs>|jdk	r||j_n||_t||dd�dS(Nu()(u_mock_delegateuNoneureturn_valueu_mock_return_valueu_check_and_set_parent(uselfuvalue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__set_return_value�s	u"NonCallableMock.__set_return_valueu1The value to be returned when the mock is called.cCs |jdkrt|�S|jS(N(u_spec_classuNoneutype(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	__class__�s
uNonCallableMock.__class__ucalledu
call_countu	call_argsucall_args_listu
mock_callscCs#|j}|dkr|jS|jS(N(u_mock_delegateuNoneu_mock_side_effectuside_effect(uselfu	delegated((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__get_side_effect�s	u!NonCallableMock.__get_side_effectcCs:t|�}|j}|dkr-||_n	||_dS(N(u	_try_iteru_mock_delegateuNoneu_mock_side_effectuside_effect(uselfuvalueu	delegated((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__set_side_effect�s
	u!NonCallableMock.__set_side_effectcCs�d|_d|_d|_t�|_t�|_t�|_x6|j	j
�D]%}t|t�rjqOn|j
�qOW|j}t|�r�||k	r�|j
�ndS(u-Restore the mock object to its initial state.iNF(uFalseucalleduNoneu	call_argsu
call_countu	_CallListu
mock_callsucall_args_listumethod_callsu_mock_childrenuvaluesu
isinstanceu
_SpecStateu
reset_mocku_mock_return_valueu_is_instance_mock(uselfuchilduret((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
reset_mock�s				uNonCallableMock.reset_mockcKs�x}t|j�ddd��D]]\}}|jd�}|j�}|}x|D]}t||�}qSWt|||�qWdS(uZSet attributes on the mock through keyword arguments.

        Attributes plus return values and side effects can be set on child
        mocks using standard dot notation and unpacking a dictionary in the
        method call:

        >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
        >>> mock.configure_mock(**attrs)ukeycSs|djd�S(Niu.(ucount(uentry((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>su0NonCallableMock.configure_mock.<locals>.<lambda>u.N(usorteduitemsusplitupopugetattrusetattr(uselfukwargsuarguvaluargsufinaluobjuentry((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuconfigure_mock
s	
uNonCallableMock.configure_mockcCs]|dkrt|��n[|jdk	r[||jksE|tkrvtd|��qvnt|�rvt|��n|jj|�}|tkr�t|��n�|dkrd}|jdk	r�t	|j|�}n|j
d|d|d|d|d|�}||j|<nFt|t�rYt
|j|j|j|j|j�}||j|<n|S(Nu
_mock_methodsuMock object has no attribute %ruparentunameuwrapsu	_new_nameu_new_parent(uAttributeErroru
_mock_methodsuNoneu_all_magicsu	_is_magicu_mock_childrenugetu_deletedu_mock_wrapsugetattru_get_child_mocku
isinstanceu
_SpecStateucreate_autospecuspecuspec_setuinstanceuparentuname(uselfunameuresultuwraps((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__getattr__ s0		uNonCallableMock.__getattr__c
Cs�|jg}|j}|}d}|dgkr9d}nt�}xz|dk	r�|}|j|j|�d}|jdkr�d}n|j}t|�|kr�Pn|jt|��qEWtt|��}|j	p�d}t
|�dkr|dd
kr|d7}qn||d<dj|�}d}|dkrJd	|}nd}	|jdk	r�d
}	|j
rwd}	n|	|jj}	ndt|�j||	t|�fS(Nu.u()uumockiu().iumock.u name=%ru spec=%ru spec_set=%ru<%s%s%s id='%s'>(u()u().(umockumock.(u_mock_new_nameu_mock_new_parentusetuNoneuappenduiduaddulistureversedu
_mock_nameulenujoinu_spec_classu	_spec_setu__name__utype(
uselfu
_name_listu_parentulastudotuseenu_firstunameuname_stringuspec_string((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__repr__CsL					

		uNonCallableMock.__repr__cCs�tstj|�S|jpg}tt|��}t|j�}dd�|D�}dd�|D�}tt	|||t|j
���S(u8Filter the output of `dir(mock)` to only useful members.cSs%g|]}|jd�s|�qS(u_(u
startswith(u.0ue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
<listcomp>~s	u+NonCallableMock.__dir__.<locals>.<listcomp>cSs2g|](}|jd�s(t|�r|�qS(u_(u
startswithu	_is_magic(u.0ue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
<listcomp>s	(u
FILTER_DIRuobjectu__dir__u
_mock_methodsudirutypeulistu__dict__usortedusetu_mock_children(uselfuextrasu	from_typeu	from_dict((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__dir__us
uNonCallableMock.__dir__c
s�|tkrtj�||�S�jrh�jdk	rh|�jkrh|�jkrhtd|��n"|tkr�d|}t|��n�|t	krL�jdk	r�|�jkr�td|��nt
|�stt��|t
||��|���fdd�}q�t�|d|�tt��||�|�j|<n>|dkre|�_dSt�|||�r�|�j|<ntj�||�S(Nu!Mock object has no attribute '%s'u.Attempting to set unsupported magic method %r.cs��||�S(N((uargsukw(uoriginaluself(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>�su-NonCallableMock.__setattr__.<locals>.<lambda>u	__class__(u_allowed_namesuobjectu__setattr__u	_spec_setu
_mock_methodsuNoneu__dict__uAttributeErroru_unsupported_magicsu_all_magicsu_is_instance_mockusetattrutypeu_get_methodu_check_and_set_parentu_mock_childrenu_spec_class(uselfunameuvalueumsg((uoriginaluselfu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__setattr__�s2
	uNonCallableMock.__setattr__cCs�|tkrJ|t|�jkrJtt|�|�||jkrJdSn||jkrltj||�n|jj|t�}|t	kr�t
|��n|tk	r�|j|=nt	|j|<dS(N(u_all_magicsutypeu__dict__udelattruobjectu__delattr__u_mock_childrenugetu_missingu_deleteduAttributeError(uselfunameuobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__delattr__�s!
uNonCallableMock.__delattr__cCs|jpd}t|||�S(Numock(u
_mock_nameu_format_call_signature(uselfuargsukwargsuname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_format_mock_call_signature�su+NonCallableMock._format_mock_call_signaturecCscd}|j||�}|j}t|�dkrF|dd�}n|j|�}|||fS(Nu!Expected call: %s
Actual call: %sii(u_format_mock_call_signatureu	call_argsulen(uselfuargsukwargsumessageuexpected_stringu	call_argsu
actual_string((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_format_mock_failure_message�s	u,NonCallableMock._format_mock_failure_messagecOsw|}|jdkr=|j||�}td|f��n|j||fkrs|j||�}t|��ndS(u�assert that the mock was called with the specified arguments.

        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock.uExpected call: %s
Not calledN(u	call_argsuNoneu_format_mock_call_signatureuAssertionErroru_format_mock_failure_message(u
_mock_selfuargsukwargsuselfuexpectedumsg((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_called_with�su"NonCallableMock.assert_called_withcOsP|}|jdks@d|jp$d|jf}t|��n|j||�S(uVassert that the mock was called exactly once and with the specified
        arguments.iu1Expected '%s' to be called once. Called %s times.umock(u
call_countu
_mock_nameuAssertionErroruassert_called_with(u
_mock_selfuargsukwargsuselfumsg((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_called_once_with�su'NonCallableMock.assert_called_once_withcCs�|s5||jkr1td||jf��ndSt|j�}g}xA|D]9}y|j|�WqQtk
r�|j|�YqQXqQW|r�tdt|�f��ndS(u�assert the mock has been called with the specified calls.
        The `mock_calls` list is checked for the calls.

        If `any_order` is False (the default) then the calls must be
        sequential. There can be extra calls before or after the
        specified calls.

        If `any_order` is True then the calls can be in any order, but
        they must all appear in `mock_calls`.u(Calls not found.
Expected: %r
Actual: %rNu%r not all found in call list(u
mock_callsuAssertionErrorulisturemoveu
ValueErroruappendutuple(uselfucallsu	any_orderu	all_callsu	not_foundukall((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_has_calls�s 


u NonCallableMock.assert_has_callscOsGt||�}||jkrC|j||�}td|��ndS(u�assert the mock has been called with the specified arguments.

        The assert passes if the mock has *ever* been called, unlike
        `assert_called_with` and `assert_called_once_with` that only pass if
        the call is the most recent one.u%s call not foundN(ucallucall_args_listu_format_mock_call_signatureuAssertionError(uselfuargsukwargsukalluexpected_string((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuassert_any_calls
uNonCallableMock.assert_any_callcKset|�}t|t�sNt|t�r3t}q[t|t�r[t}q[n
|jd}||�S(uPCreate the child mocks for attributes and return value.
        By default child mocks will be the same type as the parent.
        Subclasses of Mock may want to override this to customize the way
        child mocks are made.

        For non-callable mocks the callable variant will be used (rather than
        any custom subclass).i(utypeu
issubclassu
CallableMixinuNonCallableMagicMocku	MagicMockuNonCallableMockuMocku__mro__(uselfukwu_typeuklass((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_child_mocks	
uNonCallableMock._get_child_mockNF((u__name__u
__module__u__qualname__u__doc__u__new__uNoneu__init__uattach_mockuFalseu
mock_add_specu_mock_add_specu"_NonCallableMock__get_return_valueu"_NonCallableMock__set_return_valueu"_NonCallableMock__return_value_docupropertyureturn_valueu	__class__u_delegating_propertyucalledu
call_countu	call_argsucall_args_listu
mock_callsu!_NonCallableMock__get_side_effectu!_NonCallableMock__set_side_effectuside_effectu
reset_mockuconfigure_mocku__getattr__u__repr__u__dir__u__setattr__u__delattr__u_format_mock_call_signatureu_format_mock_failure_messageuassert_called_withuassert_called_once_withuassert_has_callsuassert_any_callu_get_child_mock(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuNonCallableMockdsF
'
	
		#2"
 cCs[|dkr|St|�r |St|�r0|Syt|�SWntk
rV|SYnXdS(N(uNoneu
_is_exceptionu	_callableuiteru	TypeError(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_try_iter&s
u	_try_itercBsb|EeZdZd
d
ed
d
d
d
d
dd
dd�
Zdd�Zdd�Zdd	�Zd
S(u
CallableMixinuc
KsH||jd<tt|�j|||||||	|
|�||_dS(Nu_mock_return_value(u__dict__u_safe_superu
CallableMixinu__init__uside_effect(uselfuspecuside_effectureturn_valueuwrapsunameuspec_setuparentu_spec_stateu	_new_nameu_new_parentukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__8s

uCallableMixin.__init__cOsdS(N((uselfuargsukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_mock_check_sigEsuCallableMixin._mock_check_sigcOs |j||�|j||�S(N(u_mock_check_sigu
_mock_call(u
_mock_selfuargsukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__call__JsuCallableMixin.__call__cOs�|}d|_|jd7_t||fdd�|_|jjt||fdd��|j}|j}|j	jtd||f��t
�}|dk}|jdk	}|j
}	x#|dk	r�t|||f�}
|jr-d}|r�d}nd}|jdkrd}n|j||}n|r�||	krH|
}nt|	||f�}|jj|�|jdk	}|r�|j
d|	}	q�n|j	j|
�|j}t|�}
|
|kr�Pn|j|
�q�Wt}|j}|dk	r�t|�r|�nt|�sXt|�}t|�r<|�n|tkrT|j}n|S|||�}|tkr�|j}q�n|jdk	r�|jtkr�|j||�S|tkr�|j}n|S(Niutwouu()u.TF(uTrueucalledu
call_countu_Callu	call_argsucall_args_listuappendu_mock_new_nameu_mock_new_parentu
mock_callsusetu_mock_parentuNoneu
_mock_nameuFalseumethod_callsuiduadduDEFAULTuside_effectu
_is_exceptionu	_callableunextureturn_valueu_mock_wrapsu_mock_return_value(u
_mock_selfuargsukwargsuselfu	_new_nameu_new_parentuseenu
skip_next_dotudo_method_callsunameuthis_mock_calludotuthis_method_callu_new_parent_iduret_valueffecturesult((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_mock_callQsr	"												uCallableMixin._mock_callN(	u__name__u
__module__u__qualname__uNoneuDEFAULTu__init__u_mock_check_sigu__call__u
_mock_call(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
CallableMixin6s	u
CallableMixincBs|EeZdZdZdS(uMocku�	
    Create a new `Mock` object. `Mock` takes several optional arguments
    that specify the behaviour of the Mock object:

    * `spec`: This can be either a list of strings or an existing object (a
      class or instance) that acts as the specification for the mock object. If
      you pass in an object then a list of strings is formed by calling dir on
      the object (excluding unsupported magic attributes and methods). Accessing
      any attribute not in this list will raise an `AttributeError`.

      If `spec` is an object (rather than a list of strings) then
      `mock.__class__` returns the class of the spec object. This allows mocks
      to pass `isinstance` tests.

    * `spec_set`: A stricter variant of `spec`. If used, attempting to *set*
      or get an attribute on the mock that isn't on the object passed as
      `spec_set` will raise an `AttributeError`.

    * `side_effect`: A function to be called whenever the Mock is called. See
      the `side_effect` attribute. Useful for raising exceptions or
      dynamically changing return values. The function is called with the same
      arguments as the mock, and unless it returns `DEFAULT`, the return
      value of this function is used as the return value.

      If `side_effect` is an iterable then each call to the mock will return
      the next value from the iterable. If any of the members of the iterable
      are exceptions they will be raised instead of returned.

    * `return_value`: The value returned when the mock is called. By default
      this is a new Mock (created on first access). See the
      `return_value` attribute.

    * `wraps`: Item for the mock object to wrap. If `wraps` is not None then
      calling the Mock will pass the call through to the wrapped object
      (returning the real result). Attribute access on the mock will return a
      Mock object that wraps the corresponding attribute of the wrapped object
      (so attempting to access an attribute that doesn't exist will raise an
      `AttributeError`).

      If the mock has an explicit `return_value` set then calls are not passed
      to the wrapped object and the `return_value` is returned instead.

    * `name`: If the mock has a name then it will be used in the repr of the
      mock. This can be useful for debugging. The name is propagated to child
      mocks.

    Mocks can also be called with arbitrary keyword arguments. These will be
    used to set attributes on the mock after it is created.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuMock�s1cCsAyt||�SWn)tk
r<t|�t||�SYnXdS(N(ugetattruAttributeErroru
__import__(uthingucompuimport_path((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_dot_lookup�s


u_dot_lookupcCs_|jd�}|jd�}t|�}x.|D]&}|d|7}t|||�}q1W|S(Nu.iu.%s(usplitupopu
__import__u_dot_lookup(utargetu
componentsuimport_pathuthingucomp((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_importer�s
u	_importercCs
t|d�S(Nuis_local(uhasattr(upatcher((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_is_started�su_is_startedcBs�|EeZdZdZe�Zdd�Zdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�ZdS(u_patchc

Cs�|dk	rE|tk	r'td��n|dk	rEtd��qEn||_||_||_||_||_||_d|_
||_||_|	|_
g|_dS(Nu,Cannot use 'new' and 'new_callable' togetheru1Cannot use 'autospec' and 'new_callable' togetherF(uNoneuDEFAULTu
ValueErrorugetteru	attributeunewunew_callableuspecucreateuFalseu	has_localuspec_setuautospecukwargsuadditional_patchers(
uselfugetteru	attributeunewuspecucreateuspec_setuautospecunew_callableukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�s$										u_patch.__init__c
Csht|j|j|j|j|j|j|j|j|j	�	}|j
|_
dd�|jD�|_|S(NcSsg|]}|j��qS((ucopy(u.0up((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
<listcomp>s	u_patch.copy.<locals>.<listcomp>(u_patchugetteru	attributeunewuspecucreateuspec_setuautospecunew_callableukwargsuattribute_nameuadditional_patchers(uselfupatcher((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyucopy	su_patch.copycCs)t|t�r|j|�S|j|�S(N(u
isinstanceutypeudecorate_classudecorate_callable(uselfufunc((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__call__s
u_patch.__call__cCsyxrt|�D]d}|jtj�s+q
nt||�}t|d�sOq
n|j�}t||||��q
W|S(Nu__call__(udiru
startswithupatchuTEST_PREFIXugetattruhasattrucopyusetattr(uselfuklassuattru
attr_valueupatcher((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyudecorate_classsu_patch.decorate_classcsTt�d�r#�jj|��St����fdd���|g�_�S(Nu	patchingscsg}g}t�}z�y�xh�jD]]}|j�}|j|�|jdk	rc|j|�q%|jtkr%|j|�q%q%W|t|�7}�||�SWn?||kr�t	|�r�|j|�nt
j�}�YnXWdx!t|�D]}|j
|�q�WXdS(N(utupleu	patchingsu	__enter__uappenduattribute_nameuNoneuupdateunewuDEFAULTu_is_startedusysuexc_infoureversedu__exit__(uargsukeywargsu
extra_argsuentered_patchersuexc_infoupatchinguarg(ufuncupatched(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyupatched/s*	
u)_patch.decorate_callable.<locals>.patched(uhasattru	patchingsuappenduwraps(uselfufunc((ufuncupatchedu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyudecorate_callable*s!u_patch.decorate_callablec
Cs�|j�}|j}t}d}y|j|}Wn*ttfk
r^t||t�}YnXd}|j	r�|tkr�td||f��n||fS(Nu!%s does not have the attribute %rFT(
ugetteru	attributeuDEFAULTuFalseu__dict__uAttributeErroruKeyErrorugetattruTrueucreate(uselfutargetunameuoriginalulocal((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuget_originalRs	u_patch.get_originalcCs�|j|j|j}}}|j|j}}|j}|j�|_|dkr]d}n|dkrrd}n|dkr�d}n|dk	r�|dk	r�t
d��n|dk	s�|dk	r�|dkr�t
d��n|j�\}}|t
kr\|dkr\d}	|dkrA|}|dkr�|}d}q�n?|dk	rk|dkr�|}d}q�n|dkr�|}n|dk	s�|dk	r�|t
kr�t
d��nt|t�r�d}	q�nt}
i}|dk	r�|}
nm|dk	s|dk	r\|}|dk	r"|}nt|�r=d|k}
n
t|�}
|
r\t}
q\n|dk	ru||d<n|dk	r�||d<nt|
t�r�t|
t�r�|jr�|j|d<n|j|�|
|�}|	r�t|�r�|}|dk	r|}nt|�r.t|�r.t}
n|jd�|
d|d	d
|�|_q�n�|dk	r�|t
k	r�t
d��n|t
kr�t
d��nt|�}|dkr�|}nt|d|d
|j|�}n|r�t
d��n|}||_||_t |j|j|�|j!dk	r�i}|jt
krW|||j!<nx<|j"D]1}|j#�}|jt
kra|j|�qaqaW|S|S(uPerform the patch.uCan't specify spec and autospecu6Can't provide explicit spec_set *and* spec or autospecu!Can't use 'spec' with create=Trueu__call__uspecuspec_setunameu_new_parentu	_new_nameu()uBautospec creates the mock for you. Can't specify autospec and new.u%Can't use 'autospec' with create=Trueu_nameu.Can't pass kwargs to a mock we aren't creatingFNT(TN($unewuspecuspec_setuautospecukwargsunew_callableugetterutargetuFalseuNoneu	TypeErroruTrueuget_originaluDEFAULTu
isinstanceutypeu	MagicMocku_is_listucallableuNonCallableMagicMocku
issubclassuNonCallableMocku	attributeuupdateu_is_instance_mocku_instance_callableupopureturn_valueuboolucreate_autospecu
temp_originaluis_localusetattruattribute_nameuadditional_patchersu	__enter__(uselfunewuspecuspec_setuautospecukwargsunew_callableuoriginalulocaluinherituKlassu_kwargsu	this_specunot_callableunew_attru
extra_argsupatchinguarg((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	__enter__gs�							



	

	
			u_patch.__enter__cGs�t|�std��n|jrO|jtk	rOt|j|j|j�nOt|j|j�|j	r�t
|j|j�r�t|j|j|j�n|`|`|`x3t|j�D]"}t|�r�|j
|�q�q�WdS(uUndo the patch.u stop called on unstarted patcherN(u_is_starteduRuntimeErroruis_localu
temp_originaluDEFAULTusetattrutargetu	attributeudelattrucreateuhasattrureverseduadditional_patchersu__exit__(uselfuexc_infoupatcher((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__exit__�s u_patch.__exit__cCs |j�}|jj|�|S(u-Activate a patch, returning any created mock.(u	__enter__u_active_patchesuadd(uselfuresult((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyustart�su_patch.startcCs|jj|�|j�S(uStop an active patch.(u_active_patchesudiscardu__exit__(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyustopsu_patch.stopN(u__name__u
__module__u__qualname__uNoneuattribute_nameusetu_active_patchesu__init__ucopyu__call__udecorate_classudecorate_callableuget_originalu	__enter__u__exit__ustartustop(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_patch�s	
(~u_patchcsfy�jdd�\�}Wn+ttfk
rItd�f��YnX�fdd�}||fS(Nu.iu.Need a valid target to patch. You supplied: %rcs
t��S(N(u	_importer((utarget(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>su_get_target.<locals>.<lambda>(ursplitu	TypeErroru
ValueError(utargetu	attributeugetter((utargetu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_targetsu_get_targetc

s4�fdd�}	t|	||||||||�	S(u
    patch the named member (`attribute`) on an object (`target`) with a mock
    object.

    `patch.object` can be used as a decorator, class decorator or a context
    manager. Arguments `new`, `spec`, `create`, `spec_set`,
    `autospec` and `new_callable` have the same meaning as for `patch`. Like
    `patch`, `patch.object` takes arbitrary keyword arguments for configuring
    the mock object it creates.

    When used as a class decorator `patch.object` honours `patch.TEST_PREFIX`
    for choosing which methods to wrap.
    cs�S(N(((utarget(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>$su_patch_object.<locals>.<lambda>(u_patch(
utargetu	attributeunewuspecucreateuspec_setuautospecunew_callableukwargsugetter((utargetu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_patch_objectsu
_patch_objectc
s�t��tkr'�fdd�}n�fdd�}|sNtd��nt|j��}|d\}	}
t||	|
|||||i�	}|	|_x[|dd�D]I\}	}
t||	|
|||||i�	}|	|_|jj|�q�W|S(u�Perform multiple patches in a single call. It takes the object to be
    patched (either as an object or a string to fetch the object by importing)
    and keyword arguments for the patches::

        with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):
            ...

    Use `DEFAULT` as the value if you want `patch.multiple` to create
    mocks for you. In this case the created mocks are passed into a decorated
    function by keyword, and a dictionary is returned when `patch.multiple` is
    used as a context manager.

    `patch.multiple` can be used as a decorator, class decorator or a context
    manager. The arguments `spec`, `spec_set`, `create`,
    `autospec` and `new_callable` have the same meaning as for `patch`. These
    arguments will be applied to *all* patches done by `patch.multiple`.

    When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX`
    for choosing which methods to wrap.
    cs
t��S(N(u	_importer((utarget(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>Bsu!_patch_multiple.<locals>.<lambda>cs�S(N(((utarget(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>Dsu=Must supply at least one keyword argument with patch.multipleiiN(	utypeustru
ValueErrorulistuitemsu_patchuattribute_nameuadditional_patchersuappend(
utargetuspecucreateuspec_setuautospecunew_callableukwargsugetteruitemsu	attributeunewupatcheruthis_patcher((utargetu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_patch_multiple+s&		u_patch_multiplec

Ks4t|�\}}	t||	|||||||�	S(u�

    `patch` acts as a function decorator, class decorator or a context
    manager. Inside the body of the function or with statement, the `target`
    is patched with a `new` object. When the function/with statement exits
    the patch is undone.

    If `new` is omitted, then the target is replaced with a
    `MagicMock`. If `patch` is used as a decorator and `new` is
    omitted, the created mock is passed in as an extra argument to the
    decorated function. If `patch` is used as a context manager the created
    mock is returned by the context manager.

    `target` should be a string in the form `'package.module.ClassName'`. The
    `target` is imported and the specified object replaced with the `new`
    object, so the `target` must be importable from the environment you are
    calling `patch` from. The target is imported when the decorated function
    is executed, not at decoration time.

    The `spec` and `spec_set` keyword arguments are passed to the `MagicMock`
    if patch is creating one for you.

    In addition you can pass `spec=True` or `spec_set=True`, which causes
    patch to pass in the object being mocked as the spec/spec_set object.

    `new_callable` allows you to specify a different class, or callable object,
    that will be called to create the `new` object. By default `MagicMock` is
    used.

    A more powerful form of `spec` is `autospec`. If you set `autospec=True`
    then the mock with be created with a spec from the object being replaced.
    All attributes of the mock will also have the spec of the corresponding
    attribute of the object being replaced. Methods and functions being
    mocked will have their arguments checked and will raise a `TypeError` if
    they are called with the wrong signature. For mocks replacing a class,
    their return value (the 'instance') will have the same spec as the class.

    Instead of `autospec=True` you can pass `autospec=some_object` to use an
    arbitrary object as the spec instead of the one being replaced.

    By default `patch` will fail to replace attributes that don't exist. If
    you pass in `create=True`, and the attribute doesn't exist, patch will
    create the attribute for you when the patched function is called, and
    delete it again afterwards. This is useful for writing tests against
    attributes that your production code creates at runtime. It is off by
    default because it can be dangerous. With it switched on you can write
    passing tests against APIs that don't actually exist!

    Patch can be used as a `TestCase` class decorator. It works by
    decorating each test method in the class. This reduces the boilerplate
    code when your test methods share a common patchings set. `patch` finds
    tests by looking for method names that start with `patch.TEST_PREFIX`.
    By default this is `test`, which matches the way `unittest` finds tests.
    You can specify an alternative prefix by setting `patch.TEST_PREFIX`.

    Patch can be used as a context manager, with the with statement. Here the
    patching applies to the indented block after the with statement. If you
    use "as" then the patched object will be bound to the name after the
    "as"; very useful if `patch` is creating a mock object for you.

    `patch` takes arbitrary keyword arguments. These will be passed to
    the `Mock` (or `new_callable`) on construction.

    `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are
    available for alternate use-cases.
    (u_get_targetu_patch(
utargetunewuspecucreateuspec_setuautospecunew_callableukwargsugetteru	attribute((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyupatch\sEcBs�|EeZdZdZfddd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZeZeZ
dS(u_patch_dictu#
    Patch a dictionary, or dictionary like object, and restore the dictionary
    to its original state after the test.

    `in_dict` can be a dictionary or a mapping like container. If it is a
    mapping then it must at least support getting, setting and deleting items
    plus iterating over keys.

    `in_dict` can also be a string specifying the name of the dictionary, which
    will then be fetched by importing it.

    `values` can be a dictionary of values to set in the dictionary. `values`
    can also be an iterable of `(key, value)` pairs.

    If `clear` is True then the dictionary will be cleared before the new
    values are set.

    `patch.dict` can also be called with arbitrary keyword arguments to set
    values in the dictionary::

        with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()):
            ...

    `patch.dict` can be used as a context manager, decorator or class
    decorator. When used as a class decorator `patch.dict` honours
    `patch.TEST_PREFIX` for choosing which methods to wrap.
    cKs\t|t�rt|�}n||_t|�|_|jj|�||_d|_	dS(N(
u
isinstanceustru	_importeruin_dictudictuvaluesuupdateuclearuNoneu	_original(uselfuin_dictuvaluesuclearukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�s		u_patch_dict.__init__csAt�t�r�j��St����fdd��}|S(Nc
s-�j�z�||�SWd�j�XdS(N(u_patch_dictu
_unpatch_dict(uargsukw(ufuself(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_inner�s
u$_patch_dict.__call__.<locals>._inner(u
isinstanceutypeudecorate_classuwraps(uselfufu_inner((ufuselfu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__call__�s
!u_patch_dict.__call__cCs�x~t|�D]p}t||�}|jtj�r
t|d�r
t|j|j|j	�}||�}t
|||�q
q
W|S(Nu__call__(udirugetattru
startswithupatchuTEST_PREFIXuhasattru_patch_dictuin_dictuvaluesuclearusetattr(uselfuklassuattru
attr_valueu	decoratoru	decorated((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyudecorate_class�su_patch_dict.decorate_classcCs|j�dS(uPatch the dict.N(u_patch_dict(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	__enter__�su_patch_dict.__enter__cCs�|j}|j}|j}y|j�}Wn7tk
rdi}x|D]}||||<qHWYnX||_|r�t|�ny|j|�Wn1tk
r�x|D]}||||<q�WYnXdS(N(uvaluesuin_dictuclearucopyuAttributeErroru	_originalu_clear_dictuupdate(uselfuvaluesuin_dictuclearuoriginalukey((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_patch_dict�s"			

	


u_patch_dict._patch_dictcCse|j}|j}t|�y|j|�Wn1tk
r`x|D]}||||<qDWYnXdS(N(uin_dictu	_originalu_clear_dictuupdateuAttributeError(uselfuin_dictuoriginalukey((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_unpatch_dicts		


u_patch_dict._unpatch_dictcGs|j�dS(uUnpatch the dict.F(u
_unpatch_dictuFalse(uselfuargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__exit__s
u_patch_dict.__exit__NF(u__name__u
__module__u__qualname__u__doc__uFalseu__init__u__call__udecorate_classu	__enter__u_patch_dictu
_unpatch_dictu__exit__ustartustop(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_patch_dict�s
u_patch_dictcCsKy|j�Wn6tk
rFt|�}x|D]
}||=q1WYnXdS(N(uclearuAttributeErrorulist(uin_dictukeysukey((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_clear_dicts

u_clear_dictcCs(x!ttj�D]}|j�qWdS(uStop all active patches.N(ulistu_patchu_active_patchesustop(upatch((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_patch_stopall'su_patch_stopallutestu�lt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod neg pos abs invert complex int float index trunc floor ceil bool next u:add sub mul div floordiv mod lshift rshift and xor or pow u ccs|]}d|VqdS(ui%sN((u.0un((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	<genexpr>@su	<genexpr>ccs|]}d|VqdS(ur%sN((u.0un((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	<genexpr>Asccs|]}d|VqdS(u__%s__N((u.0umethod((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	<genexpr>Gsugetusetudeleteureversedumissingureduceu	reduce_exugetinitargsu
getnewargsugetstateusetstateu	getformatu	setformatureprudiru
subclassesuformatcs�fdd�}||_|S(u:Turns a callable object (like a mock) into a real functioncs�|||�S(N((uselfuargsukw(ufunc(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyumethodPsu_get_method.<locals>.method(u__name__(unameufuncumethod((ufuncu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_methodNs	u_get_methodccs|]}d|VqdS(u__%s__N((u.0umethod((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	<genexpr>Wsu__getattr__u__setattr__u__init__u__new__u__prepare____instancecheck__u__subclasscheck__u__del__cCs
tj|�S(N(uobjectu__hash__(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>esu<lambda>u__hash__cCs
tj|�S(N(uobjectu__str__(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>fsu__str__cCs
tj|�S(N(uobjectu
__sizeof__(uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<lambda>gsu
__sizeof__u__lt__u__gt__u__le__u__ge__iu__int__u__contains__u__len__u__exit__y�?u__complex__g�?u	__float__u__bool__u	__index__cs�fdd�}|S(Ncs&�jj}|tk	r|S�|kS(N(u__eq__u_mock_return_valueuDEFAULT(uotheruret_val(uself(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__eq__{su_get_eq.<locals>.__eq__((uselfu__eq__((uselfu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_eqzsu_get_eqcs�fdd�}|S(Ncs �jjtk	rtS�|k	S(N(u__ne__u_mock_return_valueuDEFAULT(uother(uself(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__ne__�su_get_ne.<locals>.__ne__((uselfu__ne__((uselfu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_ne�su_get_necs�fdd�}|S(Ncs,�jj}|tkr"tg�St|�S(N(u__iter__u_mock_return_valueuDEFAULTuiter(uret_val(uself(u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__iter__�s
u_get_iter.<locals>.__iter__((uselfu__iter__((uselfu2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	_get_iter�su	_get_iteru__eq__u__ne__u__iter__cCs�tj|t�}|tk	r+||_dStj|�}|dk	r�y||�}Wntk
rvt|�}YnX||_dStj|�}|dk	r�||�|_ndS(N(	u_return_valuesugetuDEFAULTureturn_valueu_calculate_return_valueuNoneuAttributeErroru_side_effect_methodsuside_effect(umockumethodunameufixedureturn_calulatorureturn_valueu
side_effector((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_set_return_value�s	
	u_set_return_valuecBs,|EeZdZdd�Zdd�ZdS(u
MagicMixincOs'tt|�j||�|j�dS(N(u_safe_superu
MagicMixinu__init__u_mock_set_magics(uselfuargsukw((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�suMagicMixin.__init__cCs�t}|jdk	rstj|j�}t�}t|}x6|D]+}|t|�jkrAt||�qAqAWn|tt|�j�}t|�}x'|D]}t||t	||��q�WdS(N(
u_magicsu
_mock_methodsuNoneuintersectionusetutypeu__dict__udelattrusetattru
MagicProxy(uselfuthese_magicsu
remove_magicsuentryu_type((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_mock_set_magics�s	


uMagicMixin._mock_set_magicsN(u__name__u
__module__u__qualname__u__init__u_mock_set_magics(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
MagicMixin�su
MagicMixincBs)|EeZdZdZddd�ZdS(uNonCallableMagicMocku-A version of `MagicMock` that isn't callable.cCs|j||�|j�dS(u�Add a spec to a mock. `spec` can either be an object or a
        list of strings. Only attributes on the `spec` can be fetched as
        attributes from the mock.

        If `spec_set` is True then only attributes on the spec can be set.N(u_mock_add_specu_mock_set_magics(uselfuspecuspec_set((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
mock_add_spec�su"NonCallableMagicMock.mock_add_specNF(u__name__u
__module__u__qualname__u__doc__uFalseu
mock_add_spec(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuNonCallableMagicMock�scBs)|EeZdZdZddd�ZdS(u	MagicMocku�
    MagicMock is a subclass of Mock with default implementations
    of most of the magic methods. You can use MagicMock without having to
    configure the magic methods yourself.

    If you use the `spec` or `spec_set` arguments then *only* magic
    methods that exist in the spec will be created.

    Attributes and the return value of a `MagicMock` will also be `MagicMocks`.
    cCs|j||�|j�dS(u�Add a spec to a mock. `spec` can either be an object or a
        list of strings. Only attributes on the `spec` can be fetched as
        attributes from the mock.

        If `spec_set` is True then only attributes on the spec can be set.N(u_mock_add_specu_mock_set_magics(uselfuspecuspec_set((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
mock_add_spec�suMagicMock.mock_add_specNF(u__name__u
__module__u__qualname__u__doc__uFalseu
mock_add_spec(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	MagicMock�s
cBsG|EeZdZdd�Zdd�Zdd�Zd	dd�Zd	S(
u
MagicProxycCs||_||_dS(N(unameuparent(uselfunameuparent((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__�s	uMagicProxy.__init__cOs|j�}|||�S(N(ucreate_mock(uselfuargsukwargsum((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__call__�suMagicProxy.__call__cCsT|j}|j}|jd|d|d|�}t|||�t|||�|S(Nunameu	_new_nameu_new_parent(unameuparentu_get_child_mockusetattru_set_return_value(uselfuentryuparentum((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyucreate_mock�s			uMagicProxy.create_mockcCs
|j�S(N(ucreate_mock(uselfuobju_type((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__get__suMagicProxy.__get__N(u__name__u
__module__u__qualname__u__init__u__call__ucreate_mockuNoneu__get__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
MagicProxy�s	u
MagicProxycBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	u_ANYu2A helper object that compares equal to everything.cCsdS(NT(uTrue(uselfuother((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__eq__su_ANY.__eq__cCsdS(NF(uFalse(uselfuother((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__ne__su_ANY.__ne__cCsdS(Nu<ANY>((uself((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__repr__su
_ANY.__repr__N(u__name__u
__module__u__qualname__u__doc__u__eq__u__ne__u__repr__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_ANY	su_ANYcCs�d|}d}djdd�|D��}djdd�|j�D��}|r]|}n|r�|rv|d7}n||7}n||S(Nu%s(%%s)uu, cSsg|]}t|��qS((urepr(u.0uarg((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
<listcomp>s	u*_format_call_signature.<locals>.<listcomp>cSs&g|]\}}d||f�qS(u%s=%r((u.0ukeyuvalue((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
<listcomp>s	(ujoinuitems(unameuargsukwargsumessageuformatted_argsuargs_stringu
kwargs_string((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_format_call_signatures
	

u_format_call_signaturecBs�|EeZdZdZfdddddd�Zfdddddd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS(u_Callu�
    A tuple for holding the results of a call to a mock, either in the form
    `(args, kwargs)` or `(name, args, kwargs)`.

    If args or kwargs are empty then a call tuple will compare equal to
    a tuple without those values. This makes comparisons less verbose::

        _Call(('name', (), {})) == ('name',)
        _Call(('name', (1,), {})) == ('name', (1,))
        _Call(((), {'a': 'b'})) == ({'a': 'b'},)

    The `_Call` object provides a useful shortcut for comparing with call::

        _Call(((1, 2), {'a': 3})) == call(1, 2, a=3)
        _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3)

    If the _Call has no name then it will match any name.
    cCsd}f}i}t|�}|dkr<|\}}}n�|dkr�|\}	}
t|	t�r�|	}t|
t�r�|
}q�|
}q�|	|
}}nN|dkr�|\}t|t�r�|}q�t|t�r�|}q�|}n|rtj|||f�Stj||||f�S(Nuiii(ulenu
isinstanceustrutupleu__new__(uclsuvalueunameuparentutwou	from_kalluargsukwargsu_lenufirstusecond((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__new__>s0						u
_Call.__new__cCs||_||_||_dS(N(unameuparentu	from_kall(uselfuvalueunameuparentutwou	from_kall((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init___s		u_Call.__init__cCs�|tkrdSyt|�}Wntk
r8dSYnXd}t|�dkr`|\}}n|\}}}d}|dkr�fi}}n�|dkr�|\}}}n�|dkr|\}	t|	t�r�|	}i}qst|	t�r|	}fi}}qsf}|	}n]|\}
}t|
t�rf|
}t|t�rV|i}}qsf|}}n
|
|}}|r�||kr�dS||f||fkS(NuiiiiTF(uANYuTrueulenu	TypeErroruFalseu
isinstanceutupleustr(uselfuotheru	len_otheru	self_nameu	self_argsuself_kwargsu
other_nameu
other_argsuother_kwargsuvalueufirstusecond((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__eq__fsF
				
u_Call.__eq__cCs|j|�S(N(u__eq__(uselfuother((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__ne__�su_Call.__ne__cOsW|jdkr(td||fdd�S|jd}t|j||fd|d|�S(Nuunameu()uparent(unameuNoneu_Call(uselfuargsukwargsuname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__call__�s
u_Call.__call__cCsN|jdkr"td|dd�Sd|j|f}td|d|dd�S(Nunameu	from_kallu%s.%suparentF(unameuNoneu_CalluFalse(uselfuattruname((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__getattr__�su_Call.__getattr__cCs�|js8|jpd}|jd�r4d|}n|St|�dkr_d}|\}}nD|\}}}|s}d}n&|jd�s�d|}n
d|}t|||�S(Nucallu()ucall%siucall.%s(u	from_kallunameu
startswithulenu_format_call_signature(uselfunameuargsukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__repr__�s	
	

u_Call.__repr__cCsQg}|}x2|dk	r@|jr4|j|�n|j}qWtt|��S(u�For a call object that represents multiple calls, `call_list`
        returns a list of all the intermediate calls as well as the
        final call.N(uNoneu	from_kalluappenduparentu	_CallListureversed(uselfuvalsuthing((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	call_list�s	
u_Call.call_listNFT(u__name__u
__module__u__qualname__u__doc__uNoneuFalseuTrueu__new__u__init__u__eq__u__ne__u__call__u__getattr__u__repr__u	call_list(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_Call+s 2u_Callu	from_kallcKs�t|�rt|�}nt|t�}i|d6}|rMi|d6}n|dkrbi}n|j|�t}t|�tkr�i}n7t|�s�t}n"|r�|r�t	|�r�t}n|}	|dkr�d}	n|d|d|d|	d||�}
t|t
�r't|
|�}
nt||
||�|dk	r]|r]|
|j
|<n|r�|r�d|kr�t||d	dd
dd|
�|
_nxDt|�D]6}t|�r�q�nyt||�}Wntk
r�w�YnXi|d6}|ri|d6}nt|t
�sGt|||
||�}
|
|
j
|<nw|
}t|t
�rh|
j}ntd|d|d|d||�}
|
|
j
|<t|||�}t||
d
|�t|
t
�r�t|
||
�q�q�W|
S(uICreate a mock object using another object as a spec. Attributes on the
    mock will use the corresponding attribute on the `spec` object as their
    spec.

    Functions or methods being mocked will have their arguments checked
    to check that they are called with the correct signature.

    If `spec_set` is True then attempting to set attributes that don't exist
    on the spec object will raise an `AttributeError`.

    If a class is used as a spec then the return value of the mock (the
    instance of the class) will have the same spec. You can use a class as the
    spec for an instance object by passing `instance=True`. The returned mock
    will only be callable if instances of the mock are callable.

    `create_autospec` also takes arbitrary keyword arguments that are passed to
    the constructor of the created mock.uspecuspec_setuuparentu_new_parentu	_new_nameunameureturn_valueuinstanceu_nameu()u_parentu	skipfirstNT(u_is_listutypeu
isinstanceuNoneuupdateu	MagicMockuDescriptorTypesu	_callableuNonCallableMagicMocku_instance_callableu
FunctionTypesu_set_signatureu_check_signatureu_mock_childrenucreate_autospecuTrueureturn_valueudiru	_is_magicugetattruAttributeErroru
_SpecStateumocku
_must_skipusetattr(uspecuspec_setuinstanceu_parentu_nameukwargsuis_typeu_kwargsuKlassu	_new_nameumockuentryuoriginalunewuparentu	skipfirst((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyucreate_autospec�sj
	
				


cCs�t|t�s7|t|di�kr+dS|j}nxR|jD]G}|jj|t�}|tkrnqAnt|t	t
f�r�dS|SW|S(Nu__dict__F(u
isinstanceutypeugetattruFalseu	__class__u__mro__u__dict__ugetuDEFAULTustaticmethoduclassmethod(uspecuentryuis_typeuklassuresult((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_must_skipCsu
_must_skipcCs.y|jSWntk
r)t|�SYnXdS(N(u	__class__uAttributeErrorutype(uobj((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_get_classWs
u
_get_classcBs/|EeZdZddddddd�ZdS(u
_SpecStatecCs:||_||_||_||_||_||_dS(N(uspecuidsuspec_setuparentuinstanceuname(uselfuspecuspec_setuparentunameuidsuinstance((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__init__as					u_SpecState.__init__NF(u__name__u
__module__u__qualname__uFalseuNoneu__init__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu
_SpecState_su
_SpecStateucCs�tdkrNddl}ttt|j��jtt|j����an|dkrrt	dddt
�}nt	dt�}d|j_||j
_||j_||_|S(u�
    A helper function to create a mock to replace the use of `open`. It works
    for `open` called directly or used as a context manager.

    The `mock` argument is the mock object to configure. If `None` (the
    default) then a `MagicMock` will be created for you, with the API limited
    to methods or attributes available on standard file handles.

    `read_data` is a string for the `read` method of the file handle to return.
    This is an empty string by default.
    iNunameuopenuspec(u	file_specuNoneu_ioulistusetudiru
TextIOWrapperuunionuBytesIOu	MagicMockuopenuwriteureturn_valueu	__enter__uread(umocku	read_datau_iouhandle((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu	mock_openvs
6	cBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	uPropertyMockuW
    A mock intended to be used as a property, or other descriptor, on a class.
    `PropertyMock` provides `__get__` and `__set__` methods so you can specify
    a return value when it is fetched.

    Fetching a `PropertyMock` instance from an object calls the mock, with
    no args. Setting it calls the mock with the value being set.
    cKs
t|�S(N(u	MagicMock(uselfukwargs((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu_get_child_mock�suPropertyMock._get_child_mockcCs|�S(N((uselfuobjuobj_type((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__get__�suPropertyMock.__get__cCs||�dS(N((uselfuobjuval((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu__set__�suPropertyMock.__set__N(u__name__u
__module__u__qualname__u__doc__u_get_child_mocku__get__u__set__(u
__locals__((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyuPropertyMock�s(mu__all__u__version__uinspectupprintusysu	functoolsuwrapsu
BaseExceptionuBaseExceptionsuplatformujavaulangu	ThrowableuTrueu
FILTER_DIRusuperu_safe_superu_is_instance_mocku
_is_exceptionuobjectu_slottedutypeuaupropertyuDescriptorTypesuFalseu
_getsignatureu_check_signatureu_copy_func_detailsu	_callableu_is_listu_instance_callableu_set_signatureu_setup_funcu	_is_magicu_SentinelObjectu	_SentinelusentineluDEFAULTuMISSINGu_missinguDELETEDu_deletedu_copyusetu_allowed_namesu_delegating_propertyulistu	_CallListu_check_and_set_parentuBaseuNonCallableMocku	_try_iteru
CallableMixinuMocku_dot_lookupu	_importeru_is_startedu_patchu_get_targetuNoneu
_patch_objectu_patch_multipleupatchu_patch_dictu_clear_dictu_patch_stopalludictumultipleustopalluTEST_PREFIXu
magic_methodsunumericsujoinusplituinplaceurightu
_non_defaultsu_get_methodu_magicsu_all_magicsu_unsupported_magicsu_calculate_return_valueuNotImplementedu_return_valuesu_get_equ_get_neu	_get_iteru_side_effect_methodsu_set_return_valueu
MagicMixinuNonCallableMagicMocku	MagicMocku
MagicProxyu_ANYuANYu_format_call_signatureutupleu_Callucallucreate_autospecu
_must_skipu
_get_classu
_SpecStateu__eq__u
FunctionTypesu	file_specu	mock_openuPropertyMock(((u2/opt/alt/python33/lib64/python3.3/unittest/mock.pyu<module>s			$
 +							��f5� 		1	Jv						""	(
	





	�	q	

?>