Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 \ð7ã@sFd¯Zd ZddlZddlZddlZddlZddlmZddlm Z m Z dd„e eƒDƒZ e fZdejkrzddlZe ejjfZdZeZdd„Zdd„Zdd„Zd°dd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd±d'd(„Zd)d*„Zd+d,„Z Gd-d.„d.e!ƒZ"Gd/d0„d0e!ƒZ#e#ƒZ$e$j%Z%e$j&Z'e$j(Z)d1d2„Z*d3d4d5d6d7d8d9d:hZ+d;d<„Z,Gd=d>„d>e-ƒZ.d?d@„Z/GdAdB„dBe!ƒZ0GdCdD„dDe!ƒZ1GdEd „d e1ƒZ2dFdG„Z3GdHdI„dIe1ƒZ4GdJd„de4e2ƒZ5dKdL„Z6dMdN„Z7dOdP„Z8GdQdR„dRe!ƒZ9dSdT„Z:e%dddddfdUdV„Z;d²dWdX„Zd\d]„Z?d^d_„Z@e;e=_!e>e=_Ae#srÚjavaTcCstt|ƒtƒS)N)Ú issubclassÚtyper )ÚobjrrrÚ_is_instance_mock2srcCst|tƒpt|tƒot|tƒS)N)Ú isinstanceÚBaseExceptionsrr)rrrrÚ _is_exception8s r cCsœt|tƒr6| r6y |j}Wntk r.dSXd}n*t|tƒs`y |j}Wntk r^dSX|rpt|dƒ}n|}y|tj|ƒfSt k r–dSXdS)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__rÚinspectZ signatureÚ ValueError)ÚfuncZ as_instanceZeat_selfZsig_funcrrrÚ_get_signature_object?s$    r(FcsDt|||ƒ‰ˆdkrdSˆ\}‰‡fdd„}t||ƒ|t|ƒ_dS)Ncsˆj||ŽdS)N)Úbind)Ú _mock_selfÚargsÚkwargs)ÚsigrrÚchecksigdsz"_check_signature..checksig)r(Ú_copy_func_detailsrÚ_mock_check_sig)r'ÚmockÚ skipfirstÚinstancer.r)r-rÚ_check_signature_s   r4c#Csœ|j|_|j|_y |j|_Wntk r0YnXy |j|_Wntk rRYnXy |j|_Wntk rtYnXy |j|_Wntk r–YnXdS)N)Ú__name__Ú__doc__Ú__text_signature__r"Ú __module__Ú __defaults__Ú__kwdefaults__)r'Úfuncopyrrrr/js$    r/cCs&t|tƒrdSt|ddƒdk r"dSdS)NTr$F)rrÚgetattr)rrrrÚ _callable�s  r=cCst|ƒttfkS)N)rÚlistÚtuple)rrrrÚ_is_list‰sr@cCsHt|tƒst|ddƒdk Sx(|f|jD]}|jjdƒdk 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)rÚbaserrrÚ_instance_callable�s  rEc s�t|ƒs dSt|tƒ}t|||ƒ}|dkr.|S|\}‰‡fdd„}t||ƒ|j}|jƒs^d}||dœ}d|} t| |ƒ||} t| |ƒ| S)Ncsˆj||ŽdS)N)r))r+r,)r-rrr.ªsz _set_signature..checksigr;)Z _checksig_r1zYdef %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs)) r=rrr(r/r5Ú isidentifierÚexecÚ _setup_func) r1Úoriginalr3r2Úresultr'r.rÚcontextÚsrcr;r)r-rÚ_set_signaturežs$       rMc sðˆˆ_tˆƒsdS‡fdd„}‡fdd„}‡fdd„}‡fdd„}‡fd d „}‡fd d „}‡fd d„}‡‡fdd„} dˆ_dˆ_dˆ_tƒˆ_tƒˆ_tƒˆ_ˆj ˆ_ ˆj ˆ_ ˆj ˆ_ |ˆ_ |ˆ_ |ˆ_|ˆ_| ˆ_|ˆ_|ˆ_|ˆ_ˆˆ_dS)Ncs ˆj||ŽS)N)Úassert_called_with)r+r,)r1rrrNÂsz'_setup_func..assert_called_withcs ˆj||ŽS)N)Ú assert_called)r+r,)r1rrrOÄsz"_setup_func..assert_calledcs ˆj||ŽS)N)Úassert_not_called)r+r,)r1rrrPÆsz&_setup_func..assert_not_calledcs ˆj||ŽS)N)Úassert_called_once)r+r,)r1rrrQÈsz'_setup_func..assert_called_oncecs ˆj||ŽS)N)Úassert_called_once_with)r+r,)r1rrrRÊsz,_setup_func..assert_called_once_withcs ˆj||ŽS)N)Úassert_has_calls)r+r,)r1rrrSÌsz%_setup_func..assert_has_callscs ˆj||ŽS)N)Úassert_any_call)r+r,)r1rrrTÎsz$_setup_func..assert_any_callcs:tƒˆ_tƒˆ_ˆjƒˆj}t|ƒr6|ˆk r6|jƒdS)N)Ú _CallListÚ method_callsÚ mock_callsÚ reset_mockÚ return_valuer)Úret)r;r1rrrXÐs z_setup_func..reset_mockFr)r1rÚcalledÚ call_countÚ call_argsrUÚcall_args_listrVrWrYÚ side_effectÚ_mock_childrenrNrRrSrTrXrOrPrQÚ_mock_delegate) r;r1rNrOrPrQrRrSrTrXr)r;r1rrH»s:       rHcCsd|dd…|kS)Nz__%s__ééþÿÿÿr)rrrrÚ _is_magicïsrdc@s eZdZdZdd„Zdd„ZdS)Ú_SentinelObjectz!A unique, named, sentinel object.cCs ||_dS)N)r)Úselfrrrrr!õsz_SentinelObject.__init__cCs d|jS)Nz sentinel.%s)r)rfrrrÚ__repr__øsz_SentinelObject.__repr__N)r5r8Ú __qualname__r6r!rgrrrrreósrec@s eZdZdZdd„Zdd„ZdS)Ú _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!rmrrrrriüsricCs$t|ƒttttfkr t|ƒ|ƒS|S)N)rÚdictr>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.._getcSs*|j}|dkr||j|<n t|||ƒdS)N)rarBÚsetattr)rfrprrxr-rrrÚ_set$s z"_delegating_property.._set)Ú_allowed_namesÚaddÚproperty)rrxryr{rrrÚ_delegating_propertys  rc@seZdZdd„Zdd„ZdS)rUcCsnt|tƒstj||ƒSt|ƒ}t|ƒ}||kr2dSx6td||dƒD] }||||…}||krFdSqFWdS)NFréT)rr>Ú __contains__ÚlenÚrange)rfrpZ len_valueZlen_selfÚiZsub_listrrrr�1s  z_CallList.__contains__cCstjt|ƒƒS)N)ÚpprintZpformatr>)rfrrrrg?sz_CallList.__repr__N)r5r8rhr�rgrrrrrU/srUcCsxt|ƒs dS|js,|js,|jdk s,|jdk r0dS|}x|dk rR||krJdS|j}q6W|rd||_||_|rt||_||_dS)NFT)rrvrwrtru)ÚparentrprÚnew_nameÚ_parentrrrÚ_check_and_set_parentCs$     r‰c@s$eZdZdd„Zdd„Zdd„ZdS)Ú _MockItercCst|ƒ|_dS)N)Úiterr)rfrrrrr!]sz_MockIter.__init__cCs|S)Nr)rfrrrÚ__iter___sz_MockIter.__iter__cCs t|jƒS)N)Únextr)rfrrrÚ__next__asz_MockIter.__next__N)r5r8rhr!rŒrŽrrrrrŠ\srŠc@seZdZeZdZdd„ZdS)ÚBaseNcOsdS)Nr)rfr+r,rrrr!gsz Base.__init__)r5r8rhrrrrsr!rrrrr�dsr�c @sHeZdZdZdd„ZdDdd„Zd d „ZdEd d „ZdFd d„Zdd„Z dd„Z dZ e e e e ƒZ e dd„ƒZedƒZedƒZedƒZedƒZedƒZdd„Zdd„Ze eeƒZdGdddœd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Z d2d3„Z!d4d5„Z"d6d7„Z#d8d9„Z$d:d;„Z%dd?„Z'd@dA„Z(dBdC„Z)dS)Ir z A non-callable version of `Mock`cOs$t|j|fd|jiƒ}tj|ƒ}|S)Nr6)rr5r6ÚobjectÚ__new__)Úclsr+ÚkwÚnewr3rrrr‘os zNonCallableMock.__new__NÚFc 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_specrUÚconfigure_mockÚ _safe_superr r!)rfÚspecrrÚspec_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Ú attributerrrÚ attach_mock¤s zNonCallableMock.attach_mockcCs|j||ƒdS)zð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)r˜)rfr›rœrrrÚ mock_add_spec±szNonCallableMock.mock_add_specc Cs|d}d}|dk rRt|ƒ rRt|tƒr*|}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) rfr›rœr r¡r¥r§ÚresrBrrrr˜ºs  zNonCallableMock._mock_add_speccCs8|j}|jdk r|jj}|tkr4|j|dd�}||_|S)Nz())rŸrž)rrrarYrÚ_get_child_mock)rfrZrrrZ__get_return_valueÑs  z"NonCallableMock.__get_return_valuecCs,|jdk r||j_n||_t||ddƒdS)Nz())rarYrrr‰)rfrprrrZ__set_return_valueÞs  z"NonCallableMock.__set_return_valuez1The value to be returned when the mock is called.cCs|jdkrt|ƒS|jS)N)r¥r)rfrrrÚ __class__ês zNonCallableMock.__class__r[r\r]r^rWcCsT|j}|dkr|jS|j}|dk rPt|ƒ rPt|tƒ rPt|ƒ rPt|ƒ}||_|S)N)rarsr_ÚcallablerrŠr )rfÚ delegatedZsfrrrZ__get_side_effect÷sz!NonCallableMock.__get_side_effectcCs(t|ƒ}|j}|dkr||_n||_dS)N)Ú _try_iterrarsr_)rfrpr¯rrrZ__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|tƒst|tkrŒqt|j|ƒqtW|j }t|ƒrº||k rº|j|ƒdS)z-Restore the mock object to its initial state.NFr)ÚidÚappendr[r]r\rUrWr^rVrrrrsr`ÚvaluesrÚ _SpecStateÚ_deletedrXr)rfZvisitedrYr_ZchildrZrrrrX s, zNonCallableMock.reset_mockcKs`xZt|jƒdd„d�D]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|djdƒS)NrÚ.)Úcount)ÚentryrrrÚ8sz0NonCallableMock.configure_mock..)Úkeyr¶N)ÚsortedÚitemsÚsplitÚpopr<rz)rfr,ÚargÚvalr+Úfinalrr¸rrrr™+s   zNonCallableMock.configure_mockcCsö|dkrt|ƒ‚n:|jdk r<||jks.|tkrLtd|ƒ‚nt|ƒrLt|ƒ‚|jsd|jdƒrdt|ƒ‚|jj|ƒ}|tkr‚t|ƒ‚np|dkrÄd}|j dk r¤t |j |ƒ}|j |||||d�}||j|<n.t |t ƒròt|j|j|j|j|jƒ}||j|<|S) Nr¨r—zMock object has no attribute %rÚassertÚassret)r†rrržrŸ>r¨r—)rÂrÃ)r"r¨Ú _all_magicsrdr—rr`rCrµr–r<r¬rr´rr›rœr3r†r)rfrrJrrrrrmAs6            zNonCallableMock.__getattr__c Cs"|jg}|j}|}d}|dgkr$d}tƒ}xT|dk r~|}|j|j|ƒd}|jdkrZd}|j}t|ƒ|krnP|jt|ƒƒq,Wtt|ƒƒ}|jp”d}t |ƒdkr¶|dd kr¶|d7}||d<dj |ƒ}d}|dkrÜd |}d} |j dk �rd } |j �rüd } | |j j } d t|ƒj || t|ƒfS)Nr¶ú()r•r1r€ú().rúmock.z name=%rz spec=%rz spec_set=%rz<%s%s%s id='%s'>)rÅrÆ)r1rÇ)rwruror²r±r}r>Úreversedrvr‚Újoinr¥r¦r5r) rfZ _name_listrˆZlastÚdotÚseenZ_firstrZ name_stringZ spec_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|]}|jdƒs|‘qS)r)r)rÚerrrú ¢sz+NonCallableMock.__dir__..cSs$g|]}|jdƒ st|ƒr|‘qS)r)rrd)rrÌrrrrÍ£s) r r�Ú__dir__r¨rªrr>rBr»ror`)rfZextrasZ from_typeZ from_dictrrrrΙs    zNonCallableMock.__dir__cs"|tkrtjˆ||ƒSˆjrHˆjdk rH|ˆjkrH|ˆjkrHtd|ƒ‚nÌ|tkrbd|}t|ƒ‚n²|tkræˆjdk rŠ|ˆjkrŠtd|ƒ‚t |ƒs¼t t ˆƒ|t ||ƒƒ|‰‡‡fdd„}n(t ˆ|d|ƒt t ˆƒ||ƒ|ˆj|<n.|dk�rú|ˆ_dSt ˆ|||ƒ�r|ˆj|<tjˆ||ƒS)Nz!Mock object has no attribute '%s'z.Attempting to set unsupported magic method %r.csˆˆf|ž|ŽS)Nr)r+r“)rIrfrrr¹»sz-NonCallableMock.__setattr__..r­)r|r�Ú __setattr__r¦r¨rBr"Ú_unsupported_magicsrÄrrzrÚ _get_methodr‰r`r¥)rfrrpÚmsgr)rIrfrrÏ©s2       zNonCallableMock.__setattr__cCs„|tkr2|t|ƒjkr2tt|ƒ|ƒ||jkr2dS||jkrHtj||ƒ|jj|tƒ}|t krft |ƒ‚|tk rv|j|=t |j|<dS)N) rÄrrBÚdelattrr�Ú __delattr__r`rCÚ_missingrµr")rfrrrrrrÔËs   zNonCallableMock.__delattr__cCs|jpd}t|||ƒS)Nr1)rvÚ_format_call_signature)rfr+r,rrrrÚ_format_mock_call_signatureÞs z+NonCallableMock._format_mock_call_signaturecCsDd}|j||ƒ}|j}t|ƒdkr.|dd…}|j|Ž}|||fS)Nz!Expected call: %s Actual call: %sér€)r×r]r‚)rfr+r,ÚmessageÚexpected_stringr]Z actual_stringrrrÚ_format_mock_failure_messageãs    z,NonCallableMock._format_mock_failure_messagecCst|j}|dk rlt|ƒdkr(d}|\}}n |\}}}y||j||ŽfStk rh}z |jdƒSd}~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•)r§r‚r)Ú TypeErrorÚwith_traceback)rfÚ_callr-rr+r,rÌrrrÚ _call_matcherís   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\rvÚAssertionError)r*rfrÒrrrrPs  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*rfrÒrrrrO s   zNonCallableMock.assert_calledcCs.|}|jdks*d|jpd|jf}t|ƒ‚dS)z3assert that the mock was called only once. r€z8Expected '%s' to have been called once. Called %s times.r1N)r\rvrà)r*rfrÒrrrrQs  z"NonCallableMock.assert_called_oncecs||‰ˆjdkr(ˆjˆˆƒ}td|fƒ‚‡‡‡fdd„}ˆjˆˆfƒ}ˆjˆjƒ}||krxt|tƒrh|nd}t|ƒƒ|‚dS)zº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.NzExpected call: %s Not calledcsˆjˆˆƒ}|S)N)rÛ)rÒ)r+r,rfrrÚ_error_message's z:NonCallableMock.assert_called_with.._error_message)r]r×ràrßrÚ Exception)r*r+r,ÚexpectedráÚactualÚcauser)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.r€z1Expected '%s' to be called once. Called %s times.r1)r\rvràrN)r*r+r,rfrÒrrrrR1s  z'NonCallableMock.assert_called_once_withc sȇfdd„|Dƒ}t|tƒr |nd}t‡fdd„ˆjDƒƒ}|sd||kr`tdt|ƒˆjfƒ|‚dSt|ƒ}g}x:|D]2}y|j|ƒWqvtk r¦|j|ƒYqvXqvW|rÄtdt |ƒfƒ|‚dS)a‡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`.csg|]}ˆj|ƒ‘qSr)rß)rÚc)rfrrrÍFsz4NonCallableMock.assert_has_calls..Nc3s|]}ˆj|ƒVqdS)N)rß)rræ)rfrrú Hsz3NonCallableMock.assert_has_calls..z(Calls not found. Expected: %r Actual: %rz%r not all found in call list) rrârUrWràr>Úremover&r²r?)rfZcallsZ any_orderrãråZ all_callsZ not_foundZkallr)rfrrS<s*  z NonCallableMock.assert_has_callscsZˆj||fƒ}‡fdd„ˆjDƒ}||krVt|tƒr8|nd}ˆj||ƒ}td|ƒ|‚dS)zù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.csg|]}ˆj|ƒ‘qSr)rß)rræ)rfrrrÍfsz3NonCallableMock.assert_any_call..Nz%s call not found)rßr^rrâr×rà)rfr+r,rãrärårÚr)rfrrT_s zNonCallableMock.assert_any_callcKsFt|ƒ}t|tƒs2t|tƒr"t}q.) rúrûr¢r”r›rýrœrþrür,Úattribute_namerÿ)rfrørrrrisz _patch.copycCst|tƒr|j|ƒS|j|ƒS)N)rrÚdecorate_classÚdecorate_callable)rfr'rrrr$vs  z_patch.__call__cCsRxLt|ƒD]@}|jtjƒsq t||ƒ}t|dƒs2q |jƒ}t||||ƒƒq W|S)Nr$)rªrrÚ TEST_PREFIXr<r÷rrz)rfrëÚattrÚ attr_valuerørrrr|s   z_patch.decorate_classcs<tˆdƒrˆjj|ƒˆStˆƒ‡‡fdd„ƒ‰|gˆ_ˆS)NÚ patchingscsÊg}g}tƒ}z˜ybxJˆjD]@}|jƒ}|j|ƒ|jdk rF|j|ƒq|jtkr|j|ƒqW|t|ƒ7}ˆ||ŽS||kr”t|ƒr”|j|ƒt j ƒ}‚YnXWdxt |ƒD]}|j |Žq²WXdS)N) r?rÚ __enter__r²rÚupdater”rrùÚsysÚexc_inforÈÚ__exit__)r+ZkeywargsÚ extra_argsZentered_patchersr Úpatchingr¿)r'Úpatchedrrr�s*         z)_patch.decorate_callable..patched)r÷rr²r)rfr'r)r'rrrŠs   z_patch.decorate_callablec CsŽ|jƒ}|j}t}d}y|j|}Wn$ttfk rHt||tƒ}YnXd}|tkrft|t ƒrfd|_ |j r†|tkr†td||fƒ‚||fS)NFTz!%s does not have the attribute %r) rûr¢rrBr"ÚKeyErrorr<Ú _builtinsrrrý)rfrôrrIÚlocalrrrÚ get_original²sz_patch.get_originalcCs>|j|j|j}}}|j|j}}|j}|jƒ|_|dkr@d}|dkrLd}|dkrXd}|dk rp|dk rptdƒ‚|dk s€|dk r�|dkr�tdƒ‚|j ƒ\}}|t koª|dk�rTd} |dkrÐ|}|dkrö|}d}n&|dk rê|dkrö|}d}n |dkrö|}|dk �s |dk �r,|t k�rtdƒ‚t |t ƒ�r,d} t } i} |dk �rD|} nN|dk �sX|dk �r’|} |dk �rj|} t| ƒ�r~d| k} n t| ƒ } | �r’t} |dk �r¤|| d<|dk �r¶|| d <t | t ƒ�ràt| tƒ�rà|j�rà|j| d <| j|ƒ| f| Ž}| �rÀt|ƒ�rÀ|} |dk �r|} t| ƒ �r2t| ƒ �r2t} | jd ƒ| f|d d œ| —Ž|_nl|dk �r²|t k �rptd ƒ‚|t k�r‚tdƒ‚t|ƒ}|dk�r˜|}t|f||jdœ|—Ž}n|�rÀtdƒ‚|}||_||_t|j|j|ƒ|jdk �r:i}|jt k�r|||j<x.|jD]$}|j ƒ}|jt k�r|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$r›rœrz())rŸržzBautospec 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)!r”r›rœrþr,rürûrôrÜrrrrrr@r®r rr r¢r rrEr¾rYÚboolrÚ temp_originalrörzrrÿr )rfr”r›rœrþr,rürIrZinheritÚKlassÚ_kwargsZ this_specZ not_callableZnew_attrrrr¿rrrr Êsº                              z_patch.__enter__cGs¬t|ƒstdƒ‚|jr4|jtk r4t|j|j|jƒnBt|j|jƒ|j rvt |j|jƒ sd|jdkrvt|j|j|jƒ|`|`|`x$t |j ƒD]}t|ƒrŽ|j |ŽqŽWdS) zUndo the patch.z stop called on unstarted patcherr6r8r9Ú__annotations__r:N)r6r8r9rr:)rùÚ RuntimeErrorrörrrzrôr¢rÓrýr÷rÈrÿr )rfr rørrrr Hs z_patch.__exit__cCs|jƒ}|jj|ƒ|S)z-Activate a patch, returning any created mock.)r Ú_active_patchesr²)rfrJrrrÚstart`s z _patch.startc Cs.y|jj|ƒWntk r$YnX|jƒS)zStop an active patch.)rrèr&r )rfrrrÚstopgs z _patch.stop)r5r8rhrrr!rr$rrrr r rrrrrrrúIs (~rúc sPyˆjddƒ\‰}Wn&ttfk r:tdˆfƒ‚YnX‡fdd„}||fS)Nr¶r€z.Need a valid target to patch. You supplied: %rcstˆƒS)N)rõr)rôrrr¹ysz_get_target..)ÚrsplitrÜr&)rôr¢rûr)rôrÚ _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. csˆS)Nrr)rôrrr¹�sz_patch_object..)rú) rôr¢r”r›rýrœrþrür,rûr)rôrÚ _patch_object}s  r!c s°tˆƒtkr‡fdd„}n ‡fdd„}|s2tdƒ‚t|jƒƒ}|d\} } t|| | |||||iƒ } | | _xB|dd…D]2\} } t|| | |||||iƒ } | | _| jj| ƒqvW| S)a¾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. cstˆƒS)N)rõr)rôrrr¹­sz!_patch_multiple..csˆS)Nrr)rôrrr¹¯sz=Must supply at least one keyword argument with patch.multiplerr€N) rÚstrr&r>r¼rúrrÿr²) rôr›rýrœrþrür,rûr¼r¢r”røZ this_patcherr)rôrÚ_patch_multiple–s&        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ú) rôr”r›rýrœrþrür,rûr¢rrrrÇsE  c@sVeZdZdZfdfdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z eZ e 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|tƒrt|ƒ}||_t|ƒ|_|jj|ƒ||_d|_dS)N) rr"rõÚin_dictrnr³r ÚclearÚ _original)rfr%r³r&r,rrrr!0s   z_patch_dict.__init__cs.tˆtƒrˆjˆƒStˆƒ‡‡fdd„ƒ}|S)Nc s"ˆjƒz ˆ||ŽSˆjƒXdS)N)r$Ú _unpatch_dict)r+r“)ÚfrfrrÚ_inner>s z$_patch_dict.__call__.._inner)rrrr)rfr)r*r)r)rfrr$;s  z_patch_dict.__call__cCs\xVt|ƒD]J}t||ƒ}|jtjƒr t|dƒr t|j|j|j ƒ}||ƒ}t |||ƒq W|S)Nr$) rªr<rrrr÷r$r%r³r&rz)rfrërrZ decoratorZ decoratedrrrrIs   z_patch_dict.decorate_classcCs |jƒdS)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 r x|D]}||||<qˆWYnXdS)N)r³r%r&rr"r'Ú _clear_dictr )rfr³r%r&rIrºrrrr$Ys"   z_patch_dict._patch_dictc CsV|j}|j}t|ƒy|j|ƒWn.tk rPx|D]}||||<q8WYnXdS)N)r%r'r+r r")rfr%rIrºrrrr(ss z_patch_dict._unpatch_dictcGs |jƒdS)zUnpatch the dict.F)r()rfr+rrrr €sz_patch_dict.__exit__N) r5r8rhr6r!r$rr r$r(r rrrrrrr$s   r$c CsBy |jƒWn0tk r<t|ƒ}x|D] }||=q*WYnXdS)N)r&r"r>)r%Úkeysrºrrrr+‰s   r+cCs xttjƒD] }|jƒq WdS)z7Stop all active patches. LIFO to unroll nested patches.N)rÈrúrr)rrrrÚ_patch_stopall’sr-Ztestz¬lt 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)rÚnrrrrç¯srçccs|]}d|VqdS)zr%sNr)rr/rrrrç°sÚ__get__Ú__set__Ú __delete__Ú __reversed__Ú __missing__Ú __reduce__Ú __reduce_ex__Z__getinitargs__Ú__getnewargs__Ú __getstate__Ú __setstate__Ú __getformat__Ú __setformat__rgrÎÚ__subclasses__Ú __format__Ú__getnewargs_ex__cs‡fdd„}||_|S)z:Turns a callable object (like a mock) into a real functioncsˆ|f|ž|ŽS)Nr)rfr+r“)r'rrÚmethodÁsz_get_method..method)r5)rr'r?r)r'rrÑ¿s rÑcCsh|] }d|’qS)z__%s__r)rr?rrrrÇsrmrÏr!r‘Ú __prepare__Ú__instancecheck__Ú__subclasscheck__Ú__del__cCs tj|ƒS)N)r�Ú__hash__)rfrrrr¹Ösr¹cCs tj|ƒS)N)r�Ú__str__)rfrrrr¹×scCs tj|ƒS)N)r�Ú __sizeof__)rfrrrr¹Øs)rDrErFr€yð?gð?) Ú__lt__Ú__gt__Ú__le__Ú__ge__Ú__int__r�Ú__len__r Ú __complex__Ú __float__Ú__bool__Ú __index__cs‡fdd„}|S)Ncs$ˆjj}|tk r|Sˆ|kr dStS)NT)Ú__eq__rrrÚNotImplemented)ÚotherÚret_val)rfrrrQìs z_get_eq..__eq__r)rfrQr)rfrÚ_get_eqës rUcs‡fdd„}|S)Ncs ˆjjtk rtSˆ|krdStS)NF)Ú__ne__rrrrR)rS)rfrrrVös  z_get_ne..__ne__r)rfrVr)rfrÚ_get_neõs rWcs‡fdd„}|S)Ncs ˆjj}|tkrtgƒSt|ƒS)N)rŒrrrr‹)rT)rfrrrŒÿsz_get_iter..__iter__r)rfrŒr)rfrÚ _get_iterþs rX)rQrVrŒc Cs„tj|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@seZdZdd„Zdd„ZdS)Ú MagicMixincOs&|jƒtt|ƒj||Ž|jƒdS)N)Ú_mock_set_magicsršr]r!)rfr+r“rrrr!(szMagicMixin.__init__cCs’t}t|ddƒdk rTtj|jƒ}tƒ}t|}x$|D]}|t|ƒjkr4t||ƒq4W|tt|ƒjƒ}t|ƒ}x|D]}t||t ||ƒƒqtWdS)Nr¨) Ú_magicsr<Ú intersectionr¨rorrBrÓrzÚ MagicProxy)rfZ these_magicsZ remove_magicsr¸rêrrrr^.s   zMagicMixin._mock_set_magicsN)r5r8rhr!r^rrrrr]'sr]c@seZdZdZddd„ZdS)r z-A version of `MagicMock` that isn't callable.FcCs|j||ƒ|jƒdS)zð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)r˜r^)rfr›rœrrrr¤Gs z"NonCallableMagicMock.mock_add_specN)F)r5r8rhr6r¤rrrrr Esc@seZdZdZddd„ZdS)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||ƒ|jƒdS)zð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)r˜r^)rfr›rœrrrr¤]s zMagicMock.mock_add_specN)F)r5r8rhr6r¤rrrrrRs c@s.eZdZdd„Zdd„Zdd„Zd dd „ZdS) racCs||_||_dS)N)rr†)rfrr†rrrr!iszMagicProxy.__init__cOs|jƒ}|||ŽS)N)Ú create_mock)rfr+r,Úmrrrr$mszMagicProxy.__call__cCs8|j}|j}|j|||d�}t|||ƒt|||ƒ|S)N)rržrŸ)rr†r¬rzr\)rfr¸r†rcrrrrbqs  zMagicProxy.create_mockNcCs|jƒS)N)rb)rfrrêrrrr0zszMagicProxy.__get__)N)r5r8rhr!r$rbr0rrrrrahs rac@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú_ANYz2A helper object that compares equal to everything.cCsdS)NTr)rfrSrrrrQ‚sz _ANY.__eq__cCsdS)NFr)rfrSrrrrV…sz _ANY.__ne__cCsdS)Nzr)rfrrrrgˆsz _ANY.__repr__N)r5r8rhr6rQrVrgrrrrrdsrdcCsdd|}d}djdd„|Dƒƒ}djdd„t|jƒƒDƒƒ}|rD|}|r\|rT|d7}||7}||S)Nz%s(%%s)r•z, cSsg|] }t|ƒ‘qSr)Úrepr)rr¿rrrrÍ’sz*_format_call_signature..cSsg|]\}}d||f‘qS)z%s=%rr)rrºrprrrrÍ”s)rÉr»r¼)rr+r,rÙZformatted_argsZ args_stringZ kwargs_stringrrrrÖ�srÖc@sveZdZdZfddddfdd„Zfddddfdd „Zd d „ZejZd d „Z dd„Z dd„Z dd„Z dd„Z dd„ZdS)rîa£ 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. r•NFTc Cs¼f}i}t|ƒ}|dkr$|\}}}nr|dkrd|\} } t| tƒrX| }t| tƒrR| }qb| }q–| | }}n2|dkr–|\}t|tƒr‚|}nt|tƒr’|}n|}|rªtj|||fƒStj||||fƒS)NrØrbr€)r‚rr"r?r‘) r’rprr†ríÚ from_kallr+r,Ú_lenÚfirstÚsecondrrrr‘´s.      z _Call.__new__cCs||_||_||_dS)N)rvrtÚ_mock_from_kall)rfrprr†rírfrrrr!Ôsz_Call.__init__c Csf|tkr dSy t|ƒ}Wntk r,dSXd}t|ƒdkrH|\}}n |\}}}t|ddƒrzt|ddƒrz|j|jkrzdSd}|dkr’fi}}n°|dkr¦|\}}}nœ|dkrì|\} t| tƒrÈ| }i}n"t| tƒrâ| }fi}}nf}| }nV|dk�r>|\} } t| tƒ�r2| }t| tƒ�r&| i}}n f| }}n | | }}ndS|�rV||k�rVdS||f||fkS) NTFr•rbrtrrØr€)rr‚rÜr<rtrr?r") rfrSZ len_otherZ self_nameZ self_argsZ self_kwargsZ other_nameZ other_argsZ other_kwargsrprhrirrrrQÛsP                z _Call.__eq__cOs<|jdkrtd||fdd�S|jd}t|j||f||d�S)Nr•z())r)rr†)rvrî)rfr+r,rrrrr$s  z_Call.__call__cCs2|jdkrt|dd�Sd|j|f}t||dd�S)NF)rrfz%s.%s)rr†rf)rvrî)rfrrrrrrms  z_Call.__getattr__cOs|jdƒ||ŽS)Nr·)rm)rfr+r,rrrr·$sz _Call.countcOs|jdƒ||ŽS)NÚindex)rm)rfr+r,rrrrk'sz _Call.indexcCs||js&|jpd}|jdƒr"d|}|St|ƒdkr@d}|\}}n0|\}}}|sTd}n|jdƒshd|}nd|}t|||ƒS)Nrz()zcall%srbzcall.%s)rjrvrr‚rÖ)rfrr+r,rrrrg*s       z_Call.__repr__cCs8g}|}x"|dk r*|jr"|j|ƒ|j}q Wtt|ƒƒS)z•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)rjr²rtrUrÈ)rfÚvalsrðrrrÚ call_list?s   z_Call.call_list)r5r8rhr6r‘r!rQr�rVr$rmr·rkrgrmrrrrrî¡s  7rî)rfcKs,t|ƒrt|ƒ}t|tƒ}d|i}|r0d|i}n |dkr.r€éÿÿÿÿrxrxrxrx)rÚbytesr½)Ú read_dataZ data_as_listÚliner)rwrÚ_iterate_read_data s  r|r•csú‡‡fdd„}‡‡‡fdd„}‡‡‡fdd„‰tdkr`ddl}ttt|jƒƒjtt|jƒƒƒƒa|dkrttd t d �}ttd �‰ˆˆj _ t ˆƒdg‰dˆj _ dˆj_ dˆj_ dˆj_ |ˆ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 rˆjjStˆdƒS)Nr)Ú readlinesrYr>)r+r,)Ú_stateÚhandlerrÚ_readlines_side_effect( s z)mock_open.._readlines_side_effectcs(ˆjjdk rˆjjStˆƒƒjˆdƒS)Nr)ÚreadrYrrÉ)r+r,)r~rrzrrÚ_read_side_effect- s z$mock_open.._read_side_effectc3sJˆjjdk rxˆjjVqWxˆdD] }|Vq&WxtˆƒƒVq6WdS)Nr)ÚreadlinerYr)r{)r~rrzrrÚ_readline_side_effect2 s  z(mock_open.._readline_side_effectNrÚopen)rr›)r›r€cs6tˆƒˆd<ˆjjˆdkr2ˆƒˆd<ˆdˆj_tS)Nrr€)r|rƒr_r)r+r,)r„r~rrzrrÚ reset_dataS s    zmock_open..reset_data)Ú file_specÚ_ior>rorªÚ TextIOWrapperÚunionÚBytesIOrr…r rYr|Úwriter�rƒr}r_)r1rzr€r‚rˆr†r)r„r~rrzrr  s.  "     c@s(eZdZdZdd„Zdd„Zdd„ZdS) 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,rrrr¬i szPropertyMock._get_child_mockcCs|ƒS)Nr)rfrZobj_typerrrr0l szPropertyMock.__get__cCs ||ƒdS)Nr)rfrrÀrrrr1n szPropertyMock.__set__N)r5r8rhr6r¬r0r1rrrrr ` s) rrrrrrrrr r r r r )F)F)NFNNN)FFNN)Nr•)oÚ__all__Ú __version__r%r…r ÚbuiltinsÚtypesrÚ functoolsrrrªrÚ BaseExceptionrÚplatformrZlangZ Throwabler Úsuperršrr r(r4r/r=r@rErMrHrdr�rerirrZMISSINGrÕZDELETEDrµrqr|rr>rUr‰rŠr�r r°rérrórõrùrúr r!r#rr$r+r-rnZmultipleZstopallrZ magic_methodsZnumericsrÉr½ZinplaceÚrightZ _non_defaultsrÑr_rÄrÐrZrRrYrUrWrXr[r\r]r rrardrrÖr?rîrrrnr©r´rrQr#r0rrr‡r|r r rrrrÚs     4  i5 ,   1Jv        ,  w  D