File "mock.cpython-36.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python36/lib64/python3.6/unittest/__pycache__/mock.cpython-36.pyc
File size: 60.35 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

3

 f7@sFdZd
ZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddeeDZe
fZdejkrzddlZe
ejjfZdZeZddZddZddZdddZdd Zd!d"Zd#d$Zd%d&Zdd'd(Zd)d*Zd+d,Z Gd-d.d.e!Z"Gd/d0d0e!Z#e#Z$e$j%Z%e$j&Z'e$j(Z)d1d2Z*d3d4d5d6d7d8d9d:hZ+d;d<Z,Gd=d>d>e-Z.d?d@Z/GdAdBdBe!Z0GdCdDdDe!Z1GdEd	d	e1Z2dFdGZ3GdHdIdIe1Z4GdJdde4e2Z5dKdLZ6dMdNZ7dOdPZ8GdQdRdRe!Z9dSdTZ:e%dddddfdUdVZ;ddWdXZ<e%dddddfdYdZ=GdZd[d[e!Z>d\d]Z?d^d_Z@e;e=_!e>e=_Ae<e=_Be@e=_Cd`e=_DdaZEdbZFdcjGdddeeFjHDZIdcjGdfdeeFjHDZJdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxhZKdydzZLd{ddcjGeEeFeIeJgjHDZMeMeKBZNd|d}d~dddddhZOdddddddZPeQeQeQeQdddddddddZRddZSddZTddZUeSeTeUdZVddZWGddde!ZXGdd
d
eXe2ZYGdddeXe5ZZGddde!Z[Gddde!Z\e\Z]ddZ^Gddde_Z`e`ddZadddZbddZcddZdGddde!Zeefebefe]jgfZhefe]jgjifZjdakddZldddZmGddde5ZndS)Mock	MagicMockpatchsentinelDEFAULTANYcallcreate_autospec
FILTER_DIRNonCallableMockNonCallableMagicMock	mock_openPropertyMockz1.0N)
ModuleType)wrapspartialcCsh|]}|jds|qS)_)
startswith).0namer2/opt/alt/python36/lib64/python3.6/unittest/mock.py	<setcomp>#srjavaTcCstt|tS)N)
issubclasstyper
)objrrr_is_instance_mock2srcCst|tpt|tot|tS)N)
isinstanceBaseExceptionsrr)rrrr
_is_exception8s
r cCst|tr6|r6y
|j}Wntk
r.dSXd}n*t|ts`y
|j}Wntk
r^dSX|rpt|d}n|}y|tj|fSt	k
rdSXdS)z
    Given an arbitrary, possibly callable object, try to create a suitable
    signature object.
    Return a (reduced func, signature) tuple, or None.
    NT)
rr__init__AttributeError
FunctionTypes__call__rinspectZ	signature
ValueError)funcZas_instanceZeat_selfZsig_funcrrr_get_signature_object?s$


r(FcsDt|||dkrdS\}fdd}t|||t|_dS)Ncsj||dS)N)bind)
_mock_selfargskwargs)sigrrchecksigdsz"_check_signature.<locals>.checksig)r(_copy_func_detailsr_mock_check_sig)r'mock	skipfirstinstancer.r)r-r_check_signature_s
r4c#Cs|j|_|j|_y|j|_Wntk
r0YnXy|j|_Wntk
rRYnXy|j|_Wntk
rtYnXy|j|_Wntk
rYnXdS)N)__name____doc____text_signature__r"
__module____defaults____kwdefaults__)r'funcopyrrrr/js$r/cCs&t|trdSt|dddk	r"dSdS)NTr$F)rrgetattr)rrrr	_callables

r=cCst|ttfkS)N)rlisttuple)rrrr_is_listsr@cCsHt|tst|dddk	Sx(|f|jD]}|jjddk	r(dSq(WdS)ztGiven an object, return True if the object is callable.
    For classes, return True if instances would be callable.r$NTF)rrr<__mro____dict__get)rbaserrr_instance_callables
rEcst|sdSt|t}t|||}|dkr.|S|\}fdd}t|||j}|js^d}||d}d|}	t|	|||}
t|
||
S)Ncsj||dS)N)r))r+r,)r-rrr.sz _set_signature.<locals>.checksigr;)Z
_checksig_r1zYdef %s(*args, **kwargs):
    _checksig_(*args, **kwargs)
    return mock(*args, **kwargs))	r=rrr(r/r5isidentifierexec_setup_func)r1originalr3r2resultr'r.rcontextsrcr;r)r-r_set_signatures$




rMc
s_tsdSfdd}fdd}fdd}fdd}fd	d
}fdd}fd
d}fdd}	d_d_d_t_t_t_j	_	j
_
j_|_|_
|_|_|	_|_|_|__dS)Ncsj||S)N)assert_called_with)r+r,)r1rrrNsz'_setup_func.<locals>.assert_called_withcsj||S)N)
assert_called)r+r,)r1rrrOsz"_setup_func.<locals>.assert_calledcsj||S)N)assert_not_called)r+r,)r1rrrPsz&_setup_func.<locals>.assert_not_calledcsj||S)N)assert_called_once)r+r,)r1rrrQsz'_setup_func.<locals>.assert_called_oncecsj||S)N)assert_called_once_with)r+r,)r1rrrRsz,_setup_func.<locals>.assert_called_once_withcsj||S)N)assert_has_calls)r+r,)r1rrrSsz%_setup_func.<locals>.assert_has_callscsj||S)N)assert_any_call)r+r,)r1rrrTsz$_setup_func.<locals>.assert_any_callcs:t_t_jj}t|r6|k	r6|jdS)N)	_CallListmethod_calls
mock_calls
reset_mockreturn_valuer)ret)r;r1rrrXsz_setup_func.<locals>.reset_mockFr)r1rcalled
call_count	call_argsrUcall_args_listrVrWrYside_effect_mock_childrenrNrRrSrTrXrOrPrQ_mock_delegate)
r;r1rNrOrPrQrRrSrTrXr)r;r1rrHs:rHcCsd|dd|kS)Nz__%s__r)rrrr	_is_magicsrdc@s eZdZdZddZddZdS)_SentinelObjectz!A unique, named, sentinel object.cCs
||_dS)N)r)selfrrrrr!sz_SentinelObject.__init__cCs
d|jS)Nzsentinel.%s)r)rfrrr__repr__sz_SentinelObject.__repr__N)r5r8__qualname__r6r!rgrrrrresrec@s eZdZdZddZddZdS)	_SentinelzAAccess attributes to return a named object, usable as a sentinel.cCs
i|_dS)N)
_sentinels)rfrrrr!sz_Sentinel.__init__cCs|dkrt|jj|t|S)N	__bases__)r"rj
setdefaultre)rfrrrr__getattr__sz_Sentinel.__getattr__N)r5r8rhr6r!rmrrrrrisricCs$t|ttttfkr t||S|S)N)rdictr>r?set)valuerrr_copysrqrY_mock_return_valuer__mock_side_effect_mock_parent_mock_new_parent
_mock_name_mock_new_namecCs8tj|d|}||fdd}||fdd}t||S)NZ_mock_cSs"|j}|dkrt||St||S)N)rar<)rfr	_the_namer-rrr_gets
z"_delegating_property.<locals>._getcSs*|j}|dkr||j|<nt|||dS)N)rarBsetattr)rfrprrxr-rrr_set$sz"_delegating_property.<locals>._set)_allowed_namesaddproperty)rrxryr{rrr_delegating_propertys

rc@seZdZddZddZdS)rUcCsnt|tstj||St|}t|}||kr2dSx6td||dD] }||||}||krFdSqFWdS)NFrT)rr>__contains__lenrange)rfrpZ	len_valueZlen_selfiZsub_listrrrr1s
z_CallList.__contains__cCstjt|S)N)pprintZpformatr>)rfrrrrg?sz_CallList.__repr__N)r5r8rhrrgrrrrrU/srUcCsxt|sdS|js,|js,|jdk	s,|jdk	r0dS|}x|dk	rR||krJdS|j}q6W|rd||_||_|rt||_||_dS)NFT)rrvrwrtru)parentrprnew_name_parentrrr_check_and_set_parentCs$



rc@s$eZdZddZddZddZdS)	_MockItercCst||_dS)N)iterr)rfrrrrr!]sz_MockIter.__init__cCs|S)Nr)rfrrr__iter___sz_MockIter.__iter__cCs
t|jS)N)nextr)rfrrr__next__asz_MockIter.__next__N)r5r8rhr!rrrrrrr\src@seZdZeZdZddZdS)BaseNcOsdS)Nr)rfr+r,rrrr!gsz
Base.__init__)r5r8rhrrrrsr!rrrrrdsrc@sHeZdZdZddZdDddZd	d
ZdEddZdFd
dZddZ	ddZ
dZee	e
eZ
eddZedZedZedZedZedZddZddZeeeZdGdddd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Z d2d3Z!d4d5Z"d6d7Z#d8d9Z$d:d;Z%d<d=Z&dHd>d?Z'd@dAZ(dBdCZ)dS)Ir
z A non-callable version of `Mock`cOs$t|j|fd|ji}tj|}|S)Nr6)rr5r6object__new__)clsr+kwnewr3rrrros
zNonCallableMock.__new__NFcKs|dkr|}|j}
||
d<||
d<||
d<||
d<|dk	rB|}d}|
dkrR|dk	}
|j|||	|
i|
d<||
d<d|
d<d	|
d
<d|
d<d|
d
<t|
d<t|
d<t|
d<||
d<|r|jf|tt|j||||||dS)NrtrvrwruTr`_mock_wrapsraFZ_mock_calledZ_mock_call_argsrZ_mock_call_countZ_mock_call_args_listZ_mock_mock_callsrV_mock_unsafe)rB_mock_add_specrUconfigure_mock_safe_superr
r!)rfspecrrspec_setr_spec_state	_new_name_new_parent_spec_as_instance	_eat_selfZunsafer,rBrrrr!xs8




zNonCallableMock.__init__cCs(d|_d|_d|_d|_t|||dS)z
        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.Nr)rtrurvrwrz)rfr1	attributerrrattach_mocks
zNonCallableMock.attach_mockcCs|j||dS)zAdd 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)r)rfrrrrr
mock_add_specszNonCallableMock.mock_add_specc	Cs|d}d}|dk	rRt|rRt|tr*|}nt|}t|||}|oH|d}t|}|j}||d<||d<||d<||d<dS)Nr_spec_class	_spec_set_spec_signature
_mock_methods)r@rr
_get_classr(dirrB)	rfrrrrrrresrBrrrrs
zNonCallableMock._mock_add_speccCs8|j}|jdk	r|jj}|tkr4|j|dd}||_|S)Nz())rr)rrrarYr_get_child_mock)rfrZrrrZ__get_return_values

z"NonCallableMock.__get_return_valuecCs,|jdk	r||j_n||_t||dddS)Nz())rarYrrr)rfrprrrZ__set_return_values

z"NonCallableMock.__set_return_valuez1The value to be returned when the mock is called.cCs|jdkrt|S|jS)N)rr)rfrrr	__class__s
zNonCallableMock.__class__r[r\r]r^rWcCsT|j}|dkr|jS|j}|dk	rPt|rPt|trPt|rPt|}||_|S)N)rarsr_callablerrr )rf	delegatedZsfrrrZ__get_side_effectsz!NonCallableMock.__get_side_effectcCs(t|}|j}|dkr||_n||_dS)N)	_try_iterrarsr_)rfrprrrrZ__set_side_effects
z!NonCallableMock.__set_side_effect)rYr_cCs|dkrg}t||krdS|jt|d|_d|_d|_t|_t|_t|_|r^t	|_
|rhd|_x0|jj
D]"}t|tst|tkrqt|j|qtW|j
}t|r||k	r|j|dS)z-Restore the mock object to its initial state.NFr)idappendr[r]r\rUrWr^rVrrrrsr`valuesr
_SpecState_deletedrXr)rfZvisitedrYr_ZchildrZrrrrX
s,zNonCallableMock.reset_mockcKs`xZt|jdddD]B\}}|jd}|j}|}x|D]}t||}q:Wt|||qWdS)aZSet 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)cSs|djdS)Nr.)count)entryrrr<lambda>8sz0NonCallableMock.configure_mock.<locals>.<lambda>)keyrN)sorteditemssplitpopr<rz)rfr,argvalr+finalrrrrrr+s	


zNonCallableMock.configure_mockcCs|dkrt|n:|jdk	r<||jks.|tkrLtd|nt|rLt||jsd|jdrdt||jj|}|tkrt|np|dkrd}|j	dk	rt
|j	|}|j|||||d}||j|<n.t|t
rt|j|j|j|j|j}||j|<|S)	NrrzMock object has no attribute %rassertassret)rrrrr>rr)rr)r"r_all_magicsrdrrr`rCrrr<rrrrrrr3rr)rfrrJrrrrrmAs6






zNonCallableMock.__getattr__c
Cs"|jg}|j}|}d}|dgkr$d}t}xT|dk	r~|}|j|j|d}|jdkrZd}|j}t||krnP|jt|q,Wtt|}|jpd}t	|dkr|dd
kr|d7}||d<dj
|}d}|dkrd	|}d}	|jdk	rd
}	|jrd}	|	|jj
}	dt|j
||	t|fS)Nr()rr1r().rmock.z name=%rz spec=%rz spec_set=%rz<%s%s%s id='%s'>)rr)r1r)rwrurorrr}r>reversedrvrjoinrrr5r)
rfZ
_name_listrZlastdotseenZ_firstrZname_stringZspec_stringrrrrggsL




zNonCallableMock.__repr__cCshtstj|S|jpg}tt|}t|j}dd|D}dd|D}tt	|||t|j
S)z8Filter the output of `dir(mock)` to only useful members.cSsg|]}|jds|qS)r)r)rerrr
<listcomp>sz+NonCallableMock.__dir__.<locals>.<listcomp>cSs$g|]}|jdst|r|qS)r)rrd)rrrrrrs)r	r__dir__rrrr>rBrror`)rfZextrasZ	from_typeZ	from_dictrrrrs


zNonCallableMock.__dir__cs"|tkrtj||SjrHjdk	rH|jkrH|jkrHtd|n|tkrbd|}t|n|tkrjdk	r|jkrtd|t	|st
t|t|||fdd}n(t
|d|t
t|||j|<n.|dkr|_dSt
|||r|j|<tj||S)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.csf||S)Nr)r+r)rIrfrrrsz-NonCallableMock.__setattr__.<locals>.<lambda>r)r|r__setattr__rrrBr"_unsupported_magicsrrrzr_get_methodrr`r)rfrrpmsgr)rIrfrrs2




zNonCallableMock.__setattr__cCs|tkr2|t|jkr2tt||||jkr2dS||jkrHtj|||jj|t}|t	krft
||tk	rv|j|=t	|j|<dS)N)rrrBdelattrr__delattr__r`rC_missingrr")rfrrrrrrs

zNonCallableMock.__delattr__cCs|jpd}t|||S)Nr1)rv_format_call_signature)rfr+r,rrrr_format_mock_call_signatures
z+NonCallableMock._format_mock_call_signaturecCsDd}|j||}|j}t|dkr.|dd}|j|}|||fS)Nz!Expected call: %s
Actual call: %sr)rr]r)rfr+r,messageexpected_stringr]Z
actual_stringrrr_format_mock_failure_messages
z,NonCallableMock._format_mock_failure_messagecCst|j}|dk	rlt|dkr(d}|\}}n
|\}}}y||j||fStk
rh}z
|jdSd}~XqpXn|SdS)a
        Given a call (or simply an (args, kwargs) tuple), return a
        comparison key suitable for matching with other calls.
        This is a best effort method which relies on the spec's signature,
        if available, or falls back on the arguments themselves.
        Nrbr)rrr)	TypeErrorwith_traceback)rf_callr-rr+r,rrrr
_call_matchers

zNonCallableMock._call_matchercCs.|}|jdkr*d|jpd|jf}t|dS)z/assert that the mock was never called.
        rz7Expected '%s' to not have been called. Called %s times.r1N)r\rvAssertionError)r*rfrrrrrPs

z!NonCallableMock.assert_not_calledcCs(|}|jdkr$d|jpd}t|dS)z6assert that the mock was called at least once
        rz"Expected '%s' to have been called.r1N)r\rvr)r*rfrrrrrOs

zNonCallableMock.assert_calledcCs.|}|jdks*d|jpd|jf}t|dS)z3assert that the mock was called only once.
        rz8Expected '%s' to have been called once. Called %s times.r1N)r\rvr)r*rfrrrrrQs

z"NonCallableMock.assert_called_oncecs||jdkr(j}td|ffdd}jf}jj}||krxt|trh|nd}t||dS)zassert 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.NzExpected call: %s
Not calledcsj}|S)N)r)r)r+r,rfrr_error_message'sz:NonCallableMock.assert_called_with.<locals>._error_message)r]rrrr	Exception)r*r+r,expectedractualcauser)r+r,rfrrNs
z"NonCallableMock.assert_called_withcOs6|}|jdks*d|jpd|jf}t||j||S)ziassert that the mock was called exactly once and that that call was
        with the specified arguments.rz1Expected '%s' to be called once. Called %s times.r1)r\rvrrN)r*r+r,rfrrrrrR1s
z'NonCallableMock.assert_called_once_withcsfdd|D}t|tr |nd}tfddjD}|sd||kr`tdt|jf|dSt|}g}x:|D]2}y|j|Wqvtk
r|j|YqvXqvW|rtdt	|f|dS)aassert 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`.csg|]}j|qSr)r)rc)rfrrrFsz4NonCallableMock.assert_has_calls.<locals>.<listcomp>Nc3s|]}j|VqdS)N)r)rr)rfrr	<genexpr>Hsz3NonCallableMock.assert_has_calls.<locals>.<genexpr>z(Calls not found.
Expected: %r
Actual: %rz%r not all found in call list)
rrrUrWrr>remover&rr?)rfZcallsZ	any_orderrrZ	all_callsZ	not_foundZkallr)rfrrS<s*

z NonCallableMock.assert_has_callscsZj||f}fddjD}||krVt|tr8|nd}j||}td||dS)zassert 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.csg|]}j|qSr)r)rr)rfrrrfsz3NonCallableMock.assert_any_call.<locals>.<listcomp>Nz%s call not found)rr^rrrr)rfr+r,rrrrr)rfrrT_szNonCallableMock.assert_any_callcKsFt|}t|ts2t|tr"t}q<t|tr<t}n
|jd}|f|S)aPCreate 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).r)rr
CallableMixinrrr
rrA)rfr_typeklassrrrros



zNonCallableMock._get_child_mock)NNNNNNrNFNF)F)FF)N)F)*r5r8rhr6rr!rrrZ"_NonCallableMock__get_return_valueZ"_NonCallableMock__set_return_valueZ"_NonCallableMock__return_value_docr~rYrrr[r\r]r^rWZ!_NonCallableMock__get_side_effectZ!_NonCallableMock__set_side_effectr_rXrrmrgrrrrrrrPrOrQrNrRrSrTrrrrrr
lsR

)
	


&2"
			
#cCsF|dkr|St|r|St|r$|Syt|Stk
r@|SXdS)N)r r=rr)rrrrrsrc
@sBeZdZddedddddddf
ddZddZddZd	d
ZdS)rNrc	Ks6||jd<tt|j|||||||	|
f|||_dS)Nrr)rBrrr!r_)rfrr_rYrrrrrrrr,rrrr!s



zCallableMixin.__init__cOsdS)Nr)rfr+r,rrrr0szCallableMixin._mock_check_sigcOs|j|||j||S)N)r0
_mock_call)r*r+r,rrrr$szCallableMixin.__call__cOs|}d|_|jd7_t||fdd}||_|jj|t}|jdk	}|j}|j	}|dk}	|j
jtd||f|j}
x|
dk	r*|r|
jjt|||f|
jdk	}|r|
jd|}t|||f}|
j
j||
j	r|	rd}nd}|
j	dk}	|
j	||}|
j}
t
|
}
|
|krP|j|
q|W|j}|dk	rt|rL|n,t|snt|}t|rx|n
|||}|tk	r|S|jtk	r|jS|jdk	r|j||S|jS)NTr)twoz()rr)r[r\_Callr]r^rrortrvrwrWrurVrr}r_r r=rrrrrYr)r*r+r,rfrrZdo_method_callsZmethod_call_nameZmock_call_nameZ	is_a_callrZthis_mock_callrZ_new_parent_idZeffectrJrrrrs`









zCallableMixin._mock_call)r5r8rhrr!r0r$rrrrrrsrc@seZdZdZdS)ra	
    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)r5r8rhr6rrrrrs1cCs2y
t||Stk
r,t|t||SXdS)N)r<r"
__import__)thingcompimport_pathrrr_dot_lookup1s

rcCsF|jd}|jd}t|}x$|D]}|d|7}t|||}q"W|S)Nrrz.%s)rrrr)targetZ
componentsrrrrrr	_importer9s


rcCs
t|dS)Nis_local)hasattr)patcherrrr_is_startedDsrc@sdeZdZdZgZddZddZddZdd	Zd
dZ	dd
Z
ddZddZddZ
ddZdS)_patchNc

Csn|dk	r(|tk	rtd|dk	r(td||_||_||_||_||_||_d|_||_	||_
|	|_g|_dS)Nz,Cannot use 'new' and 'new_callable' togetherz1Cannot use 'autospec' and 'new_callable' togetherF)
rr&getterrrnew_callablercreateZ	has_localrautospecr,additional_patchers)
rfrrrrrrrrr,rrrr!Ns$z_patch.__init__c
CsHt|j|j|j|j|j|j|j|j|j		}|j
|_
dd|jD|_|S)NcSsg|]}|jqSr)copy)rprrrrqsz_patch.copy.<locals>.<listcomp>)rrrrrrrrrr,attribute_namer)rfrrrrrisz_patch.copycCst|tr|j|S|j|S)N)rrdecorate_classdecorate_callable)rfr'rrrr$vs

z_patch.__call__cCsRxLt|D]@}|jtjsq
t||}t|ds2q
|j}t||||q
W|S)Nr$)rrrTEST_PREFIXr<rrrz)rfrattr
attr_valuerrrrr|s

z_patch.decorate_classcs<tdrjj|Stfdd|g_S)N	patchingscsg}g}t}zybxJjD]@}|j}|j||jdk	rF|j|q|jtkr|j|qW|t|7}||S||krt|r|j|t	j
}YnXWdxt|D]}|j|qWXdS)N)
r?r	__enter__rrupdaterrrsysexc_infor__exit__)r+Zkeywargs
extra_argsZentered_patchersrpatchingr)r'patchedrrrs*




z)_patch.decorate_callable.<locals>.patched)rrrr)rfr'r)r'rrrs
z_patch.decorate_callablecCs|j}|j}t}d}y|j|}Wn$ttfk
rHt||t}YnXd}|tkrft|t	rfd|_
|j
r|tkrtd||f||fS)NFTz!%s does not have the attribute %r)rrrrBr"KeyErrorr<	_builtinsrrr)rfrrrIlocalrrrget_originalsz_patch.get_originalcCs>|j|j|j}}}|j|j}}|j}|j|_|dkr@d}|dkrLd}|dkrXd}|dk	rp|dk	rptd|dk	s|dk	r|dkrtd|j	\}}|t
ko|dkrTd}	|dkr|}|dkr|}d}n&|dk	r|dkr|}d}n|dkr|}|dk	s
|dk	r,|t
krtdt|tr,d}	t
}
i}|dk	rD|}
nN|dk	sX|dk	r|}|dk	rj|}t|r~d|k}
n
t|}
|
rt}
|dk	r||d<|dk	r||d	<t|
trt|
tr|jr|j|d
<|j||
f|}|	rt|r|}|dk	r|}t|r2t|r2t}
|jd
|
f|dd||_nl|dk	r|t
k	rptd
|t
krtdt|}|dkr|}t|f||jd|}n|rtd|}||_||_t|j|j||jdk	r:i}|jt
kr|||j<x.|jD]$}|j }|jt
kr|j|qW|S|S)zPerform the patch.FNzCan't specify spec and autospecTz6Can't provide explicit spec_set *and* spec or autospecz!Can't use 'spec' with create=Truer$rrrz())rrzBautospec creates the mock for you. Can't specify autospec and new.z%Can't use 'autospec' with create=True)r_namez.Can't pass kwargs to a mock we aren't creating)TN)!rrrrr,rrrrrrrrrr@rrrr
rr
rrErrYboolr
temp_originalrrzrrr	)rfrrrrr,rrIrZinheritKlass_kwargsZ	this_specZnot_callableZnew_attrrrrrrrr	s


















z_patch.__enter__cGst|std|jr4|jtk	r4t|j|j|jnBt|j|j|j	rvt
|j|jsd|jdkrvt|j|j|j|`|`|`x$t|jD]}t|r|j
|qWdS)	zUndo the patch.z stop called on unstarted patcherr6r8r9__annotations__r:N)r6r8r9rr:)rRuntimeErrorrrrrzrrrrrrrr
)rfrrrrrr
Hs z_patch.__exit__cCs|j}|jj||S)z-Activate a patch, returning any created mock.)r	_active_patchesr)rfrJrrrstart`sz_patch.startcCs.y|jj|Wntk
r$YnX|jS)zStop an active patch.)rrr&r
)rfrrrstopgs
z_patch.stop)r5r8rhrrr!rr$rrrr	r
rrrrrrrIs
(~rcsPyjdd\}Wn&ttfk
r:tdfYnXfdd}||fS)Nrrz.Need a valid target to patch. You supplied: %rcstS)N)rr)rrrrysz_get_target.<locals>.<lambda>)rsplitrr&)rrrr)rr_get_targetssr c

s$fdd}	t|	||||||||	S)a
    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.
    csS)Nrr)rrrrsz_patch_object.<locals>.<lambda>)r)
rrrrrrrrr,rr)rr
_patch_object}s
r!c
sttkrfdd}nfdd}|s2tdt|j}|d\}	}
t||	|
|||||i	}|	|_xB|ddD]2\}	}
t||	|
|||||i	}|	|_|jj|qvW|S)aPerform 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.
    cstS)N)rr)rrrrsz!_patch_multiple.<locals>.<lambda>csS)Nrr)rrrrsz=Must supply at least one keyword argument with patch.multiplerrN)	rstrr&r>rrrrr)
rrrrrrr,rrrrrZthis_patcherr)rr_patch_multiples&

r#c

Ks$t|\}}	t||	|||||||	S)a

    `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 will 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.
    )r r)
rrrrrrrr,rrrrrrsE
c@sVeZdZdZfdfddZddZddZd	d
ZddZd
dZ	ddZ
eZe
ZdS)_patch_dicta#
    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.
    FcKs>t|trt|}||_t||_|jj|||_d|_dS)N)	rr"rin_dictrnrr
clear	_original)rfr%rr&r,rrrr!0s

z_patch_dict.__init__cs.ttrjStfdd}|S)Nc
s"jz
||SjXdS)N)r$
_unpatch_dict)r+r)frfrr_inner>s
z$_patch_dict.__call__.<locals>._inner)rrrr)rfr)r*r)r)rfrr$;s

z_patch_dict.__call__cCs\xVt|D]J}t||}|jtjr
t|dr
t|j|j|j	}||}t
|||q
W|S)Nr$)rr<rrrrr$r%rr&rz)rfrrrZ	decoratorZ	decoratedrrrrIs

z_patch_dict.decorate_classcCs|jdS)zPatch the dict.N)r$)rfrrrr	Tsz_patch_dict.__enter__cCs|j}|j}|j}y|j}Wn2tk
rPi}x|D]}||||<q8WYnX||_|rdt|y|j|Wn.tk
rx|D]}||||<qWYnXdS)N)rr%r&rr"r'_clear_dictr
)rfrr%r&rIrrrrr$Ys"

z_patch_dict._patch_dictcCsV|j}|j}t|y|j|Wn.tk
rPx|D]}||||<q8WYnXdS)N)r%r'r+r
r")rfr%rIrrrrr(ss
z_patch_dict._unpatch_dictcGs|jdS)zUnpatch the dict.F)r()rfr+rrrr
sz_patch_dict.__exit__N)
r5r8rhr6r!r$rr	r$r(r
rrrrrrr$s
r$cCsBy|jWn0tk
r<t|}x|D]
}||=q*WYnXdS)N)r&r"r>)r%keysrrrrr+s
r+cCs xttjD]}|jqWdS)z7Stop all active patches. LIFO to unroll nested patches.N)rrrr)rrrr_patch_stopallsr-Ztestzlt le gt ge eq ne getitem setitem delitem len contains iter hash str sizeof enter exit divmod rdivmod neg pos abs invert complex int float index trunc floor ceil bool next zHadd sub mul matmul div floordiv mod lshift rshift and xor or pow truediv ccs|]}d|VqdS)zi%sNr)rnrrrrsrccs|]}d|VqdS)zr%sNr)rr/rrrrs__get____set__
__delete____reversed____missing__
__reduce__
__reduce_ex__Z__getinitargs____getnewargs____getstate____setstate__
__getformat__
__setformat__rgr__subclasses__
__format____getnewargs_ex__csfdd}||_|S)z:Turns a callable object (like a mock) into a real functioncs|f||S)Nr)rfr+r)r'rrmethodsz_get_method.<locals>.method)r5)rr'r?r)r'rrsrcCsh|]}d|qS)z__%s__r)rr?rrrrsrmrr!r__prepare____instancecheck____subclasscheck____del__cCs
tj|S)N)r__hash__)rfrrrrsrcCs
tj|S)N)r__str__)rfrrrrscCs
tj|S)N)r
__sizeof__)rfrrrrs)rDrErFry?g?)__lt____gt____le____ge____int__r__len__r
__complex__	__float____bool__	__index__csfdd}|S)Ncs$jj}|tk	r|S|kr dStS)NT)__eq__rrrNotImplemented)otherret_val)rfrrrQsz_get_eq.<locals>.__eq__r)rfrQr)rfr_get_eqsrUcsfdd}|S)Ncs jjtk	rtS|krdStS)NF)__ne__rrrrR)rS)rfrrrVs
z_get_ne.<locals>.__ne__r)rfrVr)rfr_get_nesrWcsfdd}|S)Ncs jj}|tkrtgSt|S)N)rrrrr)rT)rfrrrsz_get_iter.<locals>.__iter__r)rfrr)rfr	_get_itersrX)rQrVrcCstj|t}|tk	r||_dStj|}|dk	rdy||}Wntk
rXt|}YnX||_dStj|}|dk	r|||_dS)N)_return_valuesrCrrY_calculate_return_valuer"_side_effect_methodsr_)r1r?rZfixedZreturn_calulatorrYZ
side_effectorrrr_set_return_values

r\c@seZdZddZddZdS)
MagicMixincOs&|jtt|j|||jdS)N)_mock_set_magicsrr]r!)rfr+rrrrr!(szMagicMixin.__init__cCst}t|dddk	rTtj|j}t}t|}x$|D]}|t|jkr4t||q4W|tt|j}t|}x|D]}t||t	||qtWdS)Nr)
_magicsr<intersectionrrorrBrrz
MagicProxy)rfZthese_magicsZ
remove_magicsrrrrrr^.s

zMagicMixin._mock_set_magicsN)r5r8rhr!r^rrrrr]'sr]c@seZdZdZdddZdS)rz-A version of `MagicMock` that isn't callable.FcCs|j|||jdS)zAdd 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)rr^)rfrrrrrrGsz"NonCallableMagicMock.mock_add_specN)F)r5r8rhr6rrrrrrEsc@seZdZdZdddZdS)ra
    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`.
    FcCs|j|||jdS)zAdd 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)rr^)rfrrrrrr]szMagicMock.mock_add_specN)F)r5r8rhr6rrrrrrRs
c@s.eZdZddZddZddZd
dd	ZdS)racCs||_||_dS)N)rr)rfrrrrrr!iszMagicProxy.__init__cOs|j}|||S)N)create_mock)rfr+r,mrrrr$mszMagicProxy.__call__cCs8|j}|j}|j|||d}t|||t||||S)N)rrr)rrrrzr\)rfrrrcrrrrbqszMagicProxy.create_mockNcCs|jS)N)rb)rfrrrrrr0zszMagicProxy.__get__)N)r5r8rhr!r$rbr0rrrrrahs	rac@s(eZdZdZddZddZddZdS)	_ANYz2A helper object that compares equal to everything.cCsdS)NTr)rfrSrrrrQsz_ANY.__eq__cCsdS)NFr)rfrSrrrrVsz_ANY.__ne__cCsdS)Nz<ANY>r)rfrrrrgsz
_ANY.__repr__N)r5r8rhr6rQrVrgrrrrrdsrdcCsdd|}d}djdd|D}djddt|jD}|rD|}|r\|rT|d7}||7}||S)Nz%s(%%s)rz, cSsg|]}t|qSr)repr)rrrrrrsz*_format_call_signature.<locals>.<listcomp>cSsg|]\}}d||fqS)z%s=%rr)rrrprrrrs)rrr)rr+r,rZformatted_argsZargs_stringZ
kwargs_stringrrrrsrc@sveZdZdZfddddfddZfddddfdd	Zd
dZejZdd
Z	ddZ
ddZddZddZ
ddZdS)ra
    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.
    rNFTcCsf}i}t|}|dkr$|\}}}nr|dkrd|\}	}
t|	trX|	}t|
trR|
}qb|
}q|	|
}}n2|dkr|\}t|tr|}nt|tr|}n|}|rtj|||fStj||||fS)Nrrbr)rrr"r?r)rrprrr	from_kallr+r,_lenfirstsecondrrrrs.



z
_Call.__new__cCs||_||_||_dS)N)rvrt_mock_from_kall)rfrprrrrfrrrr!sz_Call.__init__cCsf|tkrdSyt|}Wntk
r,dSXd}t|dkrH|\}}n
|\}}}t|ddrzt|ddrz|j|jkrzdSd}|dkrfi}}n|dkr|\}}}n|dkr|\}	t|	tr|	}i}n"t|	tr|	}fi}}nf}|	}nV|dkr>|\}
}t|
tr2|
}t|tr&|i}}n
f|}}n
|
|}}ndS|rV||krVdS||f||fkS)	NTFrrbrtrrr)rrrr<rtrr?r")rfrSZ	len_otherZ	self_nameZ	self_argsZself_kwargsZ
other_nameZ
other_argsZother_kwargsrprhrirrrrQsP




z_Call.__eq__cOs<|jdkrtd||fddS|jd}t|j||f||dS)Nrz())r)rr)rvr)rfr+r,rrrrr$s

z_Call.__call__cCs2|jdkrt|ddSd|j|f}t||ddS)NF)rrfz%s.%s)rrrf)rvr)rfrrrrrrms
z_Call.__getattr__cOs|jd||S)Nr)rm)rfr+r,rrrr$sz_Call.countcOs|jd||S)Nindex)rm)rfr+r,rrrrk'sz_Call.indexcCs||js&|jpd}|jdr"d|}|St|dkr@d}|\}}n0|\}}}|sTd}n|jdshd|}nd|}t|||S)Nrz()zcall%srbzcall.%s)rjrvrrr)rfrr+r,rrrrg*s





z_Call.__repr__cCs8g}|}x"|dk	r*|jr"|j||j}q
Wtt|S)zFor a call object that represents multiple calls, `call_list`
        returns a list of all the intermediate calls as well as the
        final call.N)rjrrtrUr)rfvalsrrrr	call_list?s


z_Call.call_list)r5r8rhr6rr!rQrrVr$rmrrkrgrmrrrrrs7r)rfcKs,t|rt|}t|t}d|i}|r0d|i}n|dkr<i}|rL|rLd|d<|j|t}tj|rji}n$t|sxt}n|r|rt	|rt}|j
d|}|}	|dkrd}	|f|||	|d|}
t|trt|
|}
nt
||
|||dk	o|r|
|j|<|r,|r,d	|kr,t||dd
|
d|
_xt|D]}t|rHq6yt||}Wntk
rpw6YnXd|i}|rd|i}t|tst|||
||}
|
|
j|<nZ|
}t|tr|
j}t|||}||d<tf||||d
|}
|
|
j|<t
||
|dt|
tr6t|
||
q6W|
S)aICreate 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.rrNTrrr)rrrrrYz())r3rrr)rrrr)r2)r@rrr
rr%Zisdatadescriptorr=rrErr#rMr4r`rrYrrdr<r"rr1
_must_skiprz)rrr3rrr,is_typerrrr1rrIrrr2rrrrPst










cCs|t|ts$|t|dikrdS|j}xR|jD]H}|jj|t}|tkrHq,t|tt	frZdStt|ddt
rp|SdSq,W|S)z[
    Return whether we should skip the first argument on spec's `entry`
    attribute.
    rBFr0N)rrr<rrArBrCrstaticmethodclassmethodMethodWrapperTypes)rrrorrJrrrrns
rncCs$y|jStk
rt|SXdS)N)rr"r)rrrrrsrc@seZdZdddZdS)rFNcCs(||_||_||_||_||_||_dS)N)ridsrrr3r)rfrrrrrsr3rrrr!sz_SpecState.__init__)FNNNF)r5r8rhr!rrrrrsrc#spt|trdndfdd|jD}|dkrD|dd}n|ddd	|d
<x|D]
}|Vq^WdS)N

csg|]}|qSrr)rl)seprrr	sz&_iterate_read_data.<locals>.<listcomp>rrxrxrxrx)rbytesr)	read_dataZdata_as_listliner)rwr_iterate_read_data	s
r|rcsfdd}fdd}fddtdkr`ddl}ttt|jjtt|ja|dkrttd	t	d
}ttdj
_tdgdj
_dj_dj_dj_|j_d<dj_|j_fd
d}||_|_|S)a
    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` methoddline`, and `readlines` of the
    file handle to return.  This is an empty string by default.
    cs jjdk	rjjStdS)Nr)	readlinesrYr>)r+r,)_statehandlerr_readlines_side_effect(	sz)mock_open.<locals>._readlines_side_effectcs(jjdk	rjjStjdS)Nr)readrYrr)r+r,)r~rrzrr_read_side_effect-	sz$mock_open.<locals>._read_side_effectc3sJjjdk	rxjjVqWxdD]
}|Vq&WxtVq6WdS)Nr)readlinerYr)r{)r~rrzrr_readline_side_effect2	s
z(mock_open.<locals>._readline_side_effectNropen)rr)rrcs6td<jjdkr2d<dj_tS)Nrr)r|rr_r)r+r,)rr~rrzrr
reset_dataS	s

zmock_open.<locals>.reset_data)	file_spec_ior>ror
TextIOWrapperunionBytesIOrrr	rYr|writerrr}r_)r1rzrrrrr)rr~rrzrr	s."

c@s(eZdZdZddZddZddZdS)	r
aW
    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
tf|S)N)r)rfr,rrrri	szPropertyMock._get_child_mockcCs|S)Nr)rfrZobj_typerrrr0l	szPropertyMock.__get__cCs||dS)Nr)rfrrrrrr1n	szPropertyMock.__set__N)r5r8rhr6rr0r1rrrrr
`	s)
rrrrrrrrr	r
rrr
)F)F)NFNNN)FFNN)Nr)o__all____version__r%rrbuiltinstypesr	functoolsrrrr
BaseExceptionrplatformrZlangZ	Throwabler	superrrr r(r4r/r=r@rErMrHrdrrerirrZMISSINGrZDELETEDrrqr|rr>rUrrrr
rrrrrrrr r!r#rr$r+r-rnZmultipleZstopallrZ
magic_methodsZnumericsrrZinplacerightZ
_non_defaultsrr_rrrZrRrYrUrWrXr[r\r]rrrardrrr?rrrrnrrrrQr#r0rrrr|rr
rrrr<module>s
 

4	i5,
1Jv	

	
,

w
D