+
    Bik                        ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ]P                  ! RR7       ^ RI H
t
 ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHt R	 t ! R
 R4      t ! R R4      tR tR tR t ! R R]4      t] R2t ] R2t!]R 4       t" ! R R]PF                  4      t$ ! R R]PF                  4      t% ! R R]PF                  4      t& ! R R]PF                  4      t' ! R R]PF                  4      t( ! R  R!]PF                  4      t) ! R" R#]4      t* ! R$ R%]PF                  4      t+ ! R& R']PF                  4      t, ! R( R)]PF                  4      t- ! R* R+]PF                  4      t.]R,8X  d   ]P^                  ! 4        R# R# )-    N)contextmanager)supportT)modulerun)IsolatedAsyncioTestCase)
ANYcall	AsyncMockpatch	MagicMockMockcreate_autospecsentinel	_CallListsealc                  D    \         P                  P                  R 4       R # N)asyncioevents_set_event_loop_policy     </usr/lib/python3.14/test/test_unittest/testmock/testasync.pytearDownModuler      s    NN))$/r   c                   R   a  ] tR t^t o R tR tR t]R 4       t]	R 4       t
RtV tR# )
AsyncClassc                    R # r   r   selfs   &r   __init__AsyncClass.__init__   s    r   c                   "   R # 5ir   r   r   s   &r   async_methodAsyncClass.async_method   s     $   c                    R # r   r   r   s   &r   normal_methodAsyncClass.normal_method       Tr   c                   "   R # 5ir   r   )clss   &r   async_class_methodAsyncClass.async_class_method   s     '+r&   c                    "   R # 5ir   r   r   r   r   async_static_methodAsyncClass.async_static_method   s     %)r&   r   N)__name__
__module____qualname____firstlineno__r!   r$   r(   classmethodr-   staticmethodr0   __static_attributes____classdictcell____classdict__s   @r   r   r      s*     &!+ +) )r   r   c                   &   a  ] tR t^!t o R tRtV tR# )AwaitableClassc              #     "   R x  R # 5ir   r   r   s   &r   	__await__AwaitableClass.__await__"   s     s   	r   N)r2   r3   r4   r5   r?   r8   r9   r:   s   @r   r=   r=   !   s     r   r=   c                     "   R # 5ir   r   r   r   r   
async_funcrB   $   s     r&   c                   "   R # 5ir   r   )abcs   &&$r   async_func_argsrG   &        tr&   c                      R # r   r   r   r   r   normal_funcrJ   (       4r   c                   &   a  ] tR t^*t o R tRtV tR# )NormalClassc                    R # r   r   r   s   &r   rD   NormalClass.a+   s    r   r   N)r2   r3   r4   r5   rD   r8   r9   r:   s   @r   rM   rM   *   s     r   rM   z.AsyncClassz.NormalClassc              #      "   V P                  \        R 4      ;_uu_ 4        Rx  \        P                  ! 4        RRR4       R#   + '       g   i     R# ; i5i)zwas never awaited$N)assertWarnsRegexRuntimeWarninggccollect)tests   &r   assertNeverAwaitedrV   2   s6     			~/C	D	D 	

	 
E	D	D	Ds   AA
AA		Ac                   D   a  ] tR t^;t o R tR tR tR tR tR t	Rt
V tR# )	AsyncPatchDecoratorTestc                ^   a  \         P                  ! \        R 4      V 3R l4       pV! 4        R# )r$   c                 R   < SP                  \        P                  ! V 4      4       R # r   )
assertTrueinspectiscoroutinefunctionmock_methodr    s   &r   
test_asyncLAsyncPatchDecoratorTest.test_is_coroutine_function_patch.<locals>.test_async=   s    OOG77DEr   Nr   objectr   r    r`   s   f r    test_is_coroutine_function_patch8AsyncPatchDecoratorTest.test_is_coroutine_function_patch<   s'    	j.	1	F 
2	Fr   c                   a  \         P                  ! \        R 4      V 3R l4       p\        \         R24      V 3R l4       pV! 4        V! 4        R# )r$   c                 v   < V ! 4       pSP                  \        P                  ! V4      4       \        V4       R # r   r[   r\   isawaitabler   r_   mr    s   & r   r`   ?AsyncPatchDecoratorTest.test_is_async_patch.<locals>.test_asyncC   (    AOOG//23Fr   z.async_methodc                 v   < V ! 4       pSP                  \        P                  ! V4      4       \        V4       R # r   ri   rk   s   & r   test_no_parent_attributeMAsyncPatchDecoratorTest.test_is_async_patch.<locals>.test_no_parent_attributeI   rn   r   N)r   rc   r   async_foo_name)r    r`   rp   s   f  r   test_is_async_patch+AsyncPatchDecoratorTest.test_is_async_patchB   sN    	j.	1	 
2	
 
.!/	0	 
1	
 	 "r   c                ^   a  \         P                  ! \        R 4      V 3R l4       pV! 4        R# )r$   c                 4   < SP                  V \        4       R # r   assertIsInstancer   r^   s   &r   r`   CAsyncPatchDecoratorTest.test_is_AsyncMock_patch.<locals>.test_asyncS       !!+y9r   Nrb   rd   s   f r   test_is_AsyncMock_patch/AsyncPatchDecoratorTest.test_is_AsyncMock_patchR   s'    	j.	1	: 
2	: 	r   c                ^   a  \         P                  ! \        R 4      V 3R l4       pV! 4        R# )r0   c                 4   < SP                  V \        4       R # r   rw   r^   s   &r   r`   PAsyncPatchDecoratorTest.test_is_AsyncMock_patch_staticmethod.<locals>.test_asyncZ   rz   r   Nrb   rd   s   f r   $test_is_AsyncMock_patch_staticmethod<AsyncPatchDecoratorTest.test_is_AsyncMock_patch_staticmethodY   s(    	j"7	8	: 
9	: 	r   c                ^   a  \         P                  ! \        R 4      V 3R l4       pV! 4        R# )r-   c                 4   < SP                  V \        4       R # r   rw   r^   s   &r   r`   OAsyncPatchDecoratorTest.test_is_AsyncMock_patch_classmethod.<locals>.test_asynca   rz   r   Nrb   rd   s   f r   #test_is_AsyncMock_patch_classmethod;AsyncPatchDecoratorTest.test_is_AsyncMock_patch_classmethod`   s(    	j"6	7	: 
8	: 	r   c                   a  \        \         R 2^R7      \        \         R2^R7      V 3R l4       4       p\        V! 4       4       S P                  \        P
                  ! \        4      4       R# ).async_funcreturn_value.async_func_argsc                   <"   SP                  V P                  R 4       SP                  VP                  R4       SP                  \        \        4       SP                  \
        \        4       SP                  \        4       G Rj  xL
 ^4       SP                  \        ^^^R7      G Rj  xL
 ^4       R#  L1 L5i)rG   rB   NrF   )assertEqual
_mock_namerx   rB   r   rG   )func_args_mock	func_mockr    s   &&r   r`   @AsyncPatchDecoratorTest.test_async_def_patch.<locals>.test_asynch   s      ^668IJY11<@!!*i8!!/9=:</3?1a1#==qA 0=s$   BB>B:	%B>.B</B><B>N)r   r2   r   r[   r\   r]   rB   rd   s   f r   test_async_def_patch,AsyncPatchDecoratorTest.test_async_def_patchg   s_    	(;'a	8	(+,1	=	B 
> 
9	B 	JL33J?@r   r   N)r2   r3   r4   r5   re   rs   r{   r   r   r   r8   r9   r:   s   @r   rX   rX   ;   s*     # A Ar   rX   c                   D   a  ] tR t^xt o R tR tR tR tR tR t	Rt
V tR# )	AsyncPatchCMTestc                "   a  V 3R  lpV! 4        R# )c                     < \         P                  ! \        R 4      ;_uu_ 4       p SP                  \        P
                  ! V 4      4       RRR4       R#   + '       g   i     R# ; ir$   N)r   rc   r   r[   r\   r]   r^   s    r   r`   >AsyncPatchCMTest.test_is_async_function_cm.<locals>.test_asyncz   s<    j.99[ ; ;K HI :999s   &AA&	Nr   rd   s   f r   test_is_async_function_cm*AsyncPatchCMTest.test_is_async_function_cmy   s    	J 	r   c                "   a  V 3R  lpV! 4        R# )c                     < \         P                  ! \        R 4      ;_uu_ 4       p V ! 4       pSP                  \        P
                  ! V4      4       \        V4       RRR4       R#   + '       g   i     R# ; ir   )r   rc   r   r[   r\   rj   r   rk   s     r   r`   5AsyncPatchCMTest.test_is_async_cm.<locals>.test_async   sJ    j.99[M 3 3A 67A :999s   8A''A8	Nr   rd   s   f r   test_is_async_cm!AsyncPatchCMTest.test_is_async_cm   s    	 	r   c                "   a  V 3R  lpV! 4        R# )c                     < \         P                  ! \        R 4      ;_uu_ 4       p SP                  V \        4       RRR4       R#   + '       g   i     R# ; ir   )r   rc   r   rx   r   r^   s    r   r`   9AsyncPatchCMTest.test_is_AsyncMock_cm.<locals>.test_async   s5    j.99[%%k9= :999s   AA	Nr   rd   s   f r   test_is_AsyncMock_cm%AsyncPatchCMTest.test_is_AsyncMock_cm   s    	> 	r   c                4   a  V 3R  lp\        V! 4       4       R# )c                    <"   \        \         R 2\        4       4      ;_uu_ 4        S P                  \        \        4       RRR4       S P                  \        P                  ! \        4      4       R#   + '       g   i     L;; i5i)r   N)r   r2   r   rx   rB   r[   r\   r]   r   s   r   r`   6AsyncPatchCMTest.test_async_def_cm.<locals>.test_async   sP     (;/==%%j)< >OOG77
CD >=s   $BA53B5B	 BNr   rd   s   f r   test_async_def_cm"AsyncPatchCMTest.test_async_def_cm   s    	E
 	JLr   c                   a a R R /o\         P                  ! SR R/4      VV 3R l4       pS P                  \        P                  ! V4      4       \        V! 4       4       R# )rD   rE   c                  B   <"   SP                  S R ,          R4       R# 5irD   rE   N)r   foor    s   r   r`   >AsyncPatchCMTest.test_patch_dict_async_def.<locals>.test_async   s     SXs+s   N)r   dictr[   r\   r]   r   r    r`   r   s   f @r   test_patch_dict_async_def*AsyncPatchCMTest.test_patch_dict_async_def   sP    Cj	C#s	$	, 
%	, 	33J?@JLr   c                @   a a R R /oVV 3R lp\        V! 4       4       R# )rD   c                     <"   \         P                  ! S R R/4      ;_uu_ 4        SP                  S R ,          R4       RRR4       R#   + '       g   i     R# ; i5ir   )r   r   r   r   s   r   r`   FAsyncPatchCMTest.test_patch_dict_async_def_context.<locals>.test_async   s=     C#s,,  S3/ -,,,s   "AA	
A	A		ANr   r   s   f @r   !test_patch_dict_async_def_context2AsyncPatchCMTest.test_patch_dict_async_def_context   s    Cj	0 	JLr   r   N)r2   r3   r4   r5   r   r   r   r   r   r   r8   r9   r:   s   @r   r   r   x   s(      r   r   c                   >   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )AsyncMockTestc                d    \        4       pV P                  \        P                  ! V4      4       R # r   r   r[   r\   r]   r    mocks   & r    test_iscoroutinefunction_default.AsyncMockTest.test_iscoroutinefunction_default   s     {33D9:r   c                l    R  p\        V4      pV P                  \        P                  ! V4      4       R# )c                     "   R # 5ir   r   r   r   r   r   <AsyncMockTest.test_iscoroutinefunction_function.<locals>.foo   s     r&   Nr   r    r   r   s   &  r   !test_iscoroutinefunction_function/AsyncMockTest.test_iscoroutinefunction_function   s%    ~33D9:r   c                    \        4       pV! 4       pV P                  \        P                  ! V4      4       \	        V4       V P                  R \        V4      4       R# )assert_awaitedN)r   r[   r\   rj   r   assertIndirr    r   rl   s   &  r   test_isawaitableAsyncMockTest.test_isawaitable   sA    {F++A./A&D	2r   c                l    R  p\        V4      pV P                  \        P                  ! V4      4       R# )c                      R # r   r   r   r   r   r   CAsyncMockTest.test_iscoroutinefunction_normal_function.<locals>.foo   rK   r   Nr   r   s   &  r   (test_iscoroutinefunction_normal_function6AsyncMockTest.test_iscoroutinefunction_normal_function   s%    ~33D9:r   c                    \         P                  ! 4       pVP                  4       pVP                  4        VP	                  4        \        V4      pV P                  V\         P                  4       R # r   )r   new_event_loopcreate_futurestopcloser   rx   Future)r    loopfutr   s   &   r   test_future_isfuture"AsyncMockTest.test_future_isfuture   sM    %%'  "		

~dGNN3r   r   N)r2   r3   r4   r5   r   r   r   r   r   r8   r9   r:   s   @r   r   r      s#     ;;
3;
4 4r   r   c                   >   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )AsyncAutospecTestc                   a  \        \        R R7      V 3R l4       p\        \        R R7      V 3R l4       pV! 4        V! 4        R# )Tautospecc                 t   < SP                  V P                  \        4       SP                  V \        4       R # r   rx   r$   r   r   r^   s   &r   r`   =AsyncAutospecTest.test_is_AsyncMock_patch.<locals>.test_async   s)    !!+":":IF!!+y9r   c                 H   < SP                  V P                  \        4       R # r   )rx   r(   r   r^   s   &r   test_normal_methodEAsyncAutospecTest.test_is_AsyncMock_patch.<locals>.test_normal_method   s    !!+";";YGr   Nr   rr   )r    r`   r   s   f  r   r{   )AsyncAutospecTest.test_is_AsyncMock_patch   sF    	~	-	: 
.	: 
~	-	H 
.	H 	r   c                    V P                  \        4      ;_uu_ 4        \        \        R R7       RRR4       R#   + '       g   i     R# ; i)T)instanceN)assertRaisesRuntimeErrorr   rB   r   s   &r   test_create_autospec_instance/AsyncAutospecTest.test_create_autospec_instance   s,    |,,J6 -,,,s	   :A	c           	       a \        \        4      pV! ^^^R7      oV3R lpV P                  VP                  ^ 4       V P	                  VP
                  4       V P                  VP                  . 4       VP                  4        \        V! 4       4       V P                  \        P                  ! V4      4       V P                  \        P                  ! S4      4       V P                  \        P                  ! S4      4       V P                  VP                  ^4       V P                  VP
                  \        ^^^R7      4       V P                  VP                  \        ^^^R7      .4       VP                  4        VP!                  ^^^R7       VP#                  ^^^R7       VP%                  4        V P'                  \(        4      ;_uu_ 4        VP+                  ^R7       RRR4       R#   + '       g   i     R# ; i)   r   c                  (   <"   S G R j  xL
  R #  L5ir   r   	awaitables   r   main4AsyncAutospecTest.test_create_autospec.<locals>.main        OO   )eN)r   rG   r   await_countassertIsNone
await_argsawait_args_listassert_not_awaitedr   r[   r\   r]   r   iscoroutiner
   assert_awaited_onceassert_awaited_once_withassert_awaited_withr   r   AssertionErrorassert_any_awaitr    specr   r   s   &  @r   test_create_autospec&AsyncAutospecTest.test_create_autospec   s   /AO		 	))1-$//*--r2!DF33D9:++I67++I67))1-$q!q/:--QQ/@A  "%%aa%0  A +~..!!A!& /...s   G33H	c                  a \        \        4      pV! 4       oV P                  VP                  . 4       V3R  lpV P	                  \
        4      ;_uu_ 4        \        V! 4       4       RRR4       V P                  VP                  . 4       V P                  VP                  ^ 4       V P                  VP                  4       V P                  VP                  . 4       VP                  4        R#   + '       g   i     L; i)c                  (   <"   S G R j  xL
  R #  L5ir   r   r   s   r   r   >AsyncAutospecTest.test_autospec_checks_signature.<locals>.main   r   r   N)r   rG   assertListEqual
mock_callsr   	TypeErrorr   r   r   r   r   r   r   r  s   &  @r   test_autospec_checks_signature0AsyncAutospecTest.test_autospec_checks_signature   s    /F	T__b1	 y))K * 	T__b1))1-$//*--r2! *)s   C11D	c                4   a  V 3R  lp\        V! 4       4       R# )c            	        <"   \        \         R 2RR7      ;_uu_ 4       p V ! ^^^R7      pSP                  V P                  \        4       SP                  \        P                  ! V 4      4       SP                  \        P                  ! V4      4       SP                  \        P                  ! V4      4       SP                  \        P                  ! V4      4       SP                  V P                  ^ 4       SP                  V P                  . 4       SP                  V P                  4       V P!                  4        VG Rj  xL
  RRR4       SP                  X P                  ^4       SP                  V P                  \#        ^^^R7      4       SP                  V P                  \#        ^^^R7      .4       V P%                  4        V P'                  ^^^R7       V P)                  ^^^R7       V P+                  4        V P-                  4        SP                  V P                  ^ 4       SP                  V P                  4       SP                  V P                  . 4       R#  EL'  + '       g   i     EL.; i5i)r   Tr   r   N)r   r2   rx   r   r   r[   r\   r]   r   r  rj   r   r   r   r   r   r   r
   r  r  r  r   
reset_mock)r_   r   r    s     r   r`   >AsyncAutospecTest.test_patch_with_autospec.<locals>.test_async  s    (#34tDD'12	%%k&6&6	B ; ;K HI 3 3I >? 3 3I >? 3 3I >?   !8!8!<  !<!<bA!!+"8"89..0 E" [44a8[33T!Q!_E[8841?:KL++-00A0;++AqA+6&&(""$[44a8k445[88"=   EDDs0   JD(I2I/	I2D"J/I22J	=	JNr   rd   s   f r   test_patch_with_autospec*AsyncAutospecTest.test_patch_with_autospec
  s    	>> 	JLr   r   N)r2   r3   r4   r5   r{   r   r	  r  r  r8   r9   r:   s   @r   r   r      s#     7'6"(! !r   r   c                   n   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tRtV tR# )AsyncSpecTesti.  c                   a  V 3R  lp\         \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                    < V ! \         4      pSP                  VP                  \        4       SP                  VP                  \
        4       R # r   )r   rx   r$   r   r(   r   )	mock_typer   r    s   & r   
inner_testCAsyncSpecTest.test_spec_normal_methods_on_class.<locals>.inner_test0  s9    Z(D!!$"3"3Y?!!$"4"4i@r   ztest method types with Nr   r   subTestr    r  r  s   f  r   !test_spec_normal_methods_on_class/AsyncSpecTest.test_spec_normal_methods_on_class/  sL    	A
 $Y/I 7	{CDD9% ED 0DDD   	A

Ac                    \        \        4      pV P                  VP                  \        4       V P                  VP
                  \         4       R # r   )r   r   rx   r$   r   r(   r   s   & r   +test_spec_normal_methods_on_class_with_mock9AsyncSpecTest.test_spec_normal_methods_on_class_with_mock9  s8    Jd//;d00$7r   c                P   \        \        4      p\        V4       V P                  \        4      ;_uu_ 4        VP
                   R R R 4       V P                  \        4      ;_uu_ 4        VP                   R R R 4       R #   + '       g   i     LD; i  + '       g   i     R # ; ir   )r   r   r   r   AttributeErrorr(   r$   r   s   & r   0test_spec_normal_methods_on_class_with_mock_seal>AsyncSpecTest.test_spec_normal_methods_on_class_with_mock_seal>  sg    JT
~.. /~.. /. /....s   B*BB	B%	c                    \        4       p\        Vn        \        Vn        \        VR 7      p\        Vn        V P                  VP                  \        4       V P                  VP                  \        4       R# spec_setN)	r   rB   async_func_attrrJ   later_async_func_attrr   rx   r   assertNotIsInstance)r    async_instancemock_async_instances   &  r   #test_spec_async_attributes_instance1AsyncSpecTest.test_spec_async_attributes_instanceF  sZ    #)3&/:,"N;/9,1AA9M  !4!J!JIVr   c                   a  V 3R  lp\         \        \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                 2  < V ! \         R 7      pSP                  W4       \        S4      ;_uu_ 4        SP                  \        P
                  ! V! 4       4      4       RRR4       V ! \        R 7      pSP                  W 4       R#   + '       g   i     L0; ir  NrB   rx   rV   r[   r\   rj   rJ   r  
async_mock	sync_mockr    s   &  r   r  8AsyncSpecTest.test_spec_mock_type_kw.<locals>.inner_testT  sg    "
3J!!*8#D)) 3 3JL AB * "{3I!!)7	 *)s   +BB	ztest spec kwarg with Nr   r   r   r!  r"  s   f  r   test_spec_mock_type_kw$AsyncSpecTest.test_spec_mock_type_kwS  sM    	8 $Y5I 5i[ABB9% CB 6BBB   	AA c                   a  V 3R  lp\         \        \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                 .  < V ! \         4      pSP                  W4       \        S4      ;_uu_ 4        SP                  \        P
                  ! V! 4       4      4       R R R 4       V ! \        4      pSP                  W 4       R #   + '       g   i     L/; ir   r<  r=  s   &  r   r  @AsyncSpecTest.test_spec_mock_type_positional.<locals>.inner_testb  sg    ":.J!!*8#D)) 3 3JL AB * "+.I!!)7	 *)s   +BB	ztest spec positional with NrA  r"  s   f  r   test_spec_mock_type_positional,AsyncSpecTest.test_spec_mock_type_positionala  sM    	8 $Y5I :9+FGG9% HG 6GGGrD  c                    \        \        R 7      pV P                  V\         4       V! 4       pV P                  \        P
                  ! V4      4       \        V4       R# r:  r   rJ   rx   r[   r\   rj   r   r   s   &  r    test_spec_as_normal_kw_AsyncMock.AsyncSpecTest.test_spec_as_normal_kw_AsyncMocko  sA    k*dI.F++A./Ar   c                    \        \        4      pV P                  V\         4       V! 4       pV P                  \        P
                  ! V4      4       \        V4       R # r   rK  r   s   &  r   (test_spec_as_normal_positional_AsyncMock6AsyncSpecTest.test_spec_as_normal_positional_AsyncMockv  sA    %dI.F++A./Ar   c                b   a  \         P                  ! \        R RR7      V 3R l4       pV! 4        R# )r$   Tr;  c                 4   < SP                  V \        4       R # r   rw   r^   s   &r   r`   6AsyncSpecTest.test_spec_async_mock.<locals>.test_async~  rz   r   Nrb   rd   s   f r   test_spec_async_mock"AsyncSpecTest.test_spec_async_mock}  s)    	j.t	<	: 
=	: 	r   c                J   a  \        \        R R7      V 3R l4       pV! 4        R# )Tr;  c                 t   < SP                  V \        4       SP                  V P                  \        4       R # r   )rx   r   r$   r   r^   s   &r   r`   IAsyncSpecTest.test_spec_parent_not_async_attribute_is.<locals>.test_async  s)    !!+y9!!+":":IFr   Nr   rd   s   f r   'test_spec_parent_not_async_attribute_is5AsyncSpecTest.test_spec_parent_not_async_attribute_is  s%    	~D	)	G 
*	G 	r   c                ~   a  \         P                  ! \        R \        P                  R7      V 3R l4       pV! 4        R# )r$   r;  c                    < SP                  V \        4       SP                  \        P                  ! V 4      4       SP                  \        P
                  ! V 4      4       R # r   )rx   r   assertFalser\   r  rj   r^   s   &r   test_async_attributeFAsyncSpecTest.test_target_async_spec_not.<locals>.test_async_attribute  sE    !!+y9W00=>W00=>r   N)r   rc   r   rM   rD   )r    r^  s   f r   test_target_async_spec_not(AsyncSpecTest.test_target_async_spec_not  s/    	j.{}}	E	? 
F	?
 	r   c                j   a  \         P                  ! \        R \        R7      V 3R l4       pV! 4        R# )rD   r;  c                 4   < SP                  V \        4       R # r   rw   )mock_async_funcr    s   &r    test_attribute_not_async_spec_isUAsyncSpecTest.test_target_not_async_spec_is.<locals>.test_attribute_not_async_spec_is  s    !!/9=r   N)r   rc   rM   rB   )r    re  s   f r   test_target_not_async_spec_is+AsyncSpecTest.test_target_not_async_spec_is  s(    	k3Z	8	> 
9	>(*r   c                R   a  \        \        \        R 7      V 3R l4       pV! 4        R# )r;  c                 t   < SP                  V P                  \        4       SP                  V \        4       R # r   r   )MockNormalClassr    s   &r    test_async_attributes_coroutinesRAsyncSpecTest.test_spec_async_attributes.<locals>.test_async_attributes_coroutines  s)    !!/">">	J!!/9=r   N)r   normal_foo_namer   )r    rl  s   f r   test_spec_async_attributes(AsyncSpecTest.test_spec_async_attributes  s$    	Z	0	> 
1	> 	)*r   r   N)r2   r3   r4   r5   r#  r'  r+  r6  rB  rH  rL  rO  rT  rY  r`  rg  ro  r8   r9   r:   s   @r   r  r  .  sL     &8
W&&++ +r   r  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )AsyncSpecSetTesti  c                b   a  \         P                  ! \        R RR7      V 3R l4       pV! 4        R# )r$   Tr/  c                 4   < SP                  V \        4       R # r   rw   )r$   r    s   &r   r`   <AsyncSpecSetTest.test_is_AsyncMock_patch.<locals>.test_async  s    !!,	:r   Nrb   rd   s   f r   r{   (AsyncSpecSetTest.test_is_AsyncMock_patch  s(    	j.4	@	; 
A	;r   c                    \        \        P                  R 7      pV P                  \        P
                  ! V4      4       V P                  V\         4       R# r.  )r   r   r$   r[   r\   r]   rx   r   s   & r   test_is_async_AsyncMock(AsyncSpecSetTest.test_is_async_AsyncMock  s9    *"9"9:33D9:dI.r   c                   \        \        R 7      pV P                  \        P                  ! VP
                  4      4       V P                  \        P                  ! VP                  4      4       V P                  VP
                  \        4       V P                  VP                  \         4       V P                  V\         4       R# r.  )
r   r   r[   r\   r]   r$   r]  r(   rx   r   r   s   & r   test_is_child_AsyncMock(AsyncSpecSetTest.test_is_child_AsyncMock  s    *-33D4E4EFG44T5G5GHId//;d00)<dI.r   c                    \        4       p\        R  R7      Vn        \        P                  ! VR4      ;_uu_ 4       pV P	                  V\         4       RRR4       R#   + '       g   i     R# ; i)c                     V # r   r   xs   &r   <lambda>=AsyncSpecSetTest.test_magicmock_lambda_spec.<locals>.<lambda>  s    ar   r;  	mock_funcN)r   r  r   rc   rx   )r    mock_objcms   &  r   test_magicmock_lambda_spec+AsyncSpecSetTest.test_magicmock_lambda_spec  sH    ;&K8\\(K00B!!"i0 1000s   AA.	r   N)
r2   r3   r4   r5   r{   rx  r{  r  r8   r9   r:   s   @r   rr  rr    s     /
/1 1r   rr  c                   n   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tRtV tR# )AsyncArgumentsi  c                v   "   R  p\        V^
R7      pV! ^4      G Rj  xL
 pV P                  V^
4       R#  L5i)c                    "   R # 5ir   r   )r    vars   &&r   addition6AsyncArguments.test_add_return_value.<locals>.addition  rH   r&   r   Nr   r   )r    r  r   outputs   &   r   test_add_return_value$AsyncArguments.test_add_return_value  s4     +3Aw$ s   979c                   "    ! R  R\         4      pR p\        W!! R4      R7      pV P                  VR4      ;_uu_ 4        V! ^4      G Rj  xL
  RRR4       R#  L  + '       g   i     R# ; i5i)c                       ] tR tRtRtR# )BAsyncArguments.test_add_side_effect_exception.<locals>.CustomErrori  r   Nr2   r3   r4   r5   r8   r   r   r   CustomErrorr    s    dr   r  c                    "   R # 5ir   r   r  s   &r   r  ?AsyncArguments.test_add_side_effect_exception.<locals>.addition  s     r&   zside-effectside_effectN)	Exceptionr   assertRaisesRegex)r    r  r  r   s   &   r   test_add_side_effect_exception-AsyncArguments.test_add_side_effect_exception  sW     *)*%{=/IJ##K??q'MM @? @??s/   ?A2AAA
A2AA/	)	A2c                t   "   R  p\        VR7      pV! ^4      G Rj  xL
 pV P                  V^4       R#  L5i)c                    "   V ^,           # 5ir   r   r  s   &r   r  ?AsyncArguments.test_add_side_effect_coroutine.<locals>.addition  s     7Ns   
r  Nr  r    r  r   results   &   r   test_add_side_effect_coroutine-AsyncArguments.test_add_side_effect_coroutine  4     	X.Aw#    868c                t   "   R  p\        VR7      pV! ^4      G Rj  xL
 pV P                  V^4       R#  L5i)c                     V ^,           # r  r   r  s   &r   r  EAsyncArguments.test_add_side_effect_normal_function.<locals>.addition  s    7Nr   r  Nr  r  s   &   r   $test_add_side_effect_normal_function3AsyncArguments.test_add_side_effect_normal_function  r  r  c                  "   . ROp\        VR7      pV F"  pT P                  V! 4       G Rj  xL
 V4       K$  	  V P                  \        4      ;_uu_ 4       pV! 4       G Rj  xL
  RRR4       R#  LD L  + '       g   i     R# ; i5i)r   r  Nr         )r   r   r   StopAsyncIteration)r    valsr   itemr   s   &    r   test_add_side_effect_iterable,AsyncArguments.test_add_side_effect_iterable  sn     T*D46\40  122a&LL 32 *  322s9   +B
A2
*B
A6#A4$A6(B
4A66B		B
c                (  "    ! R  R\         4      p^V! R4      .p\        VR7      pT P                  V! 4       G Rj  xL
 ^4       V P                  V4      ;_uu_ 4       pV! 4       G Rj  xL
  RRR4       R#  L< L  + '       g   i     R# ; i5i)c                       ] tR tRtRtR# )OAsyncArguments.test_add_side_effect_exception_iterable.<locals>.SampleExceptioni  r   Nr  r   r   r   SampleExceptionr    s    r   r  r   r  N)r  r   r   r   )r    r  r  r   r   s   &    r   'test_add_side_effect_exception_iterable6AsyncArguments.test_add_side_effect_exception_iterable  sy     	i 	 ?5)*T*tvq)//1&LL 0/ &  0//s9   ;BA:"B A>+A<,A>0B<A>>B			Bc                   "   \        ^
R7      p\        VR7      pV! 4       G Rj  xL
 pV P                  W14       R#  L5i)
   r   N)r   assertIs)r    valuer   r  s   &   r   test_return_value_AsyncMock*AsyncArguments.test_return_value_AsyncMock  s3     r*e,vf$ s   #?=?c                   "   \         P                  ! 4       pVP                  R 4       \        VR7      pV! 4       G R j  xL
 pV P	                  V\         P                  4       R #  L&5i)Nr   )r   r   
set_resultr   rx   r    r   r   r  s   &   r   test_return_value_awaitable*AsyncArguments.test_return_value_awaitable  sI     nntc*vfgnn5 s   =A(A& 'A(c                l  "   \         P                  ! 4       pVP                  R 4       \        V.R7      pV! 4       G R j  xL
 pV P	                  V\         P                  4       V P                  \        4      ;_uu_ 4        V! 4       G R j  xL
  R R R 4       R #  L[ L  + '       g   i     R # ; i5i)Nr  )r   r   r  r   rx   r   r  r  s   &   r   !test_side_effect_awaitable_values0AsyncArguments.test_side_effect_awaitable_values  s~     nntcU+vfgnn5122&LL 32   322s<   >B4 BAB4B BB B4B  B1	+	B4c                   "   \        ^
R7      p\        VR7      pV! 4       G Rj  xL
 pV P                  V^
4       R#  L5i)r  r   r  Nr  )r    effectr   r  s   &   r   test_side_effect_is_AsyncMock,AsyncArguments.test_side_effect_is_AsyncMock
  s7     +V,v$ s   #A >A c                   aa"   \         P                  ! 4       oR oVV3R lp\        VR7      pV! 4       G Rj  xL
 pV P                  VS4       VP	                  4        V P                  S4       R#  L95i)Fc                     <"   R o S# 5iTr   ranr  s   r   inner2AsyncArguments.test_wraps_coroutine.<locals>.inner  s     CL   wrapsN)r   r   r   r   r   r[   r    r  r   r  r  r  s   &   @@r   test_wraps_coroutine#AsyncArguments.test_wraps_coroutine  s^      	
 u%v' s   5A5A3:A5c                   aa"   ^oRoVV3R lp\        VR7      pV! 4       G Rj  xL
 pV P                  VS4       VP                  4        V P                  S4       R#  L95i)r   Fc                     < R o S# r  r   r  s   r   r  8AsyncArguments.test_wraps_normal_function.<locals>.inner$  s    CLr   r  N)r   r   r   r[   r  s   &   @@r   test_wraps_normal_function)AsyncArguments.test_wraps_normal_function   sW     	
 u%v' s   "A"A :A"c                |  "   \        4       pV! ^4      pV! ^4      pVG Rj  xL
  VG Rj  xL
  VP                  \        ^4      \        ^4      .4       V P                  VP                  \        ^4      \        ^4      .4       V P                  VP
                  \        ^4      \        ^4      .4       R#  L L5i)r  N)r   assert_has_awaitsr
   r   r   call_args_list)r    r>  mock2mock1s   &   r   test_await_args_list_order)AsyncArguments.test_await_args_list_order/  s     [
11$$d1gtAw%7833d1gtAw5GH22T!Wd1g4FG	 	s     B<B8	B<B:BB<:B<r   N)r2   r3   r4   r5   r  r  r  r  r  r  r  r  r  r  r  r  r  r8   r9   r:   s   @r   r  r    sM     %$$	%6	%H Hr   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	AsyncMagicMethodsi:  c                   \        4       pV P                  VP                  \        4       V P                  VP                  \        4       V P                  VP
                  \        4       V P                  VP                  \         4       R # r   )r   rx   
__aenter__r   	__aexit__	__anext__	__aiter__r    m_mocks   & r   +test_async_magic_methods_return_async_mocks=AsyncMagicMethods.test_async_magic_methods_return_async_mocks;  sc    f//;f..	:f..	: 	f..	:r   c                   \        4       pV P                  VP                  \        4       V P                  VP                  \        4       V P                  VP
                  \        4       V P                  VP                  \        4       R # r   )r   rx   	__enter__r   __exit____next____len__r    a_mocks   & r   *test_sync_magic_methods_return_magic_mocks<AsyncMagicMethods.test_sync_magic_methods_return_magic_mocksD  s[    f..	:fooy9fooy9fnni8r   c                    \        4       pV P                  VR 4       V P                  VR4       V P                  VR4       R# )r  r  r  N)r   assertHasAttrr  s   & r   &test_magicmock_has_async_magic_methods8AsyncMagicMethods.test_magicmock_has_async_magic_methodsK  s9    6<06;/6;/r   c                    \        4       pV P                  VR 4       V P                  VR4       V P                  VR4       V P                  VR4       R# )r  r  r  r  N)r   r  r  s   & r   %test_asyncmock_has_sync_magic_methods7AsyncMagicMethods.test_asyncmock_has_sync_magic_methodsQ  sI    6;/6:.6:.69-r   c                V   \        4       pV P                  VP                  \        4       V P                  VP                  \        4       V P                  \        P                  ! VP                  4      4       V P                  \        P                  ! VP                  4      4       R # r   )r   rx   r  r   r  r[   r\   r]   r  s   & r   &test_magic_methods_are_async_functions8AsyncMagicMethods.test_magic_methods_are_async_functionsX  so    f//;f..	:33F4E4EFG33F4D4DEFr   r   N)r2   r3   r4   r5   r  r  r   r  r  r8   r9   r:   s   @r   r  r  :  s%     ;90.G Gr   r  c                   z   a  ] tR tRt o  ! R R4      t ! R R4      t ! R R4      tR tR	 tR
 t	R t
R tRtV tR# )AsyncContextManagerTesti`  c                   ,   a  ] tR tRt o R tR tRtV tR# )/AsyncContextManagerTest.WithAsyncContextManagerib  c                   "   R # 5ir   r   r    argskwargss   &*,r   r  :AsyncContextManagerTest.WithAsyncContextManager.__aenter__c  s     Tr&   c                   "   R # 5ir   r   r  s   &*,r   r  9AsyncContextManagerTest.WithAsyncContextManager.__aexit__e  s     Dr&   r   N)r2   r3   r4   r5   r  r  r8   r9   r:   s   @r   WithAsyncContextManagerr  b  s     988r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# ).AsyncContextManagerTest.WithSyncContextManagerig  c                    R # r   r   r  s   &*,r   r  8AsyncContextManagerTest.WithSyncContextManager.__enter__h  s    dr   c                    R # r   r   r  s   &*,r   r  7AsyncContextManagerTest.WithSyncContextManager.__exit__j  s    Tr   r   N)r2   r3   r4   r5   r  r  r8   r9   r:   s   @r   WithSyncContextManagerr  g  s     211r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )&AsyncContextManagerTest.ProductionCodeil  c                    R V n         R # r   sessionr   s   &r   r!   /AsyncContextManagerTest.ProductionCode.__init__n  s	    DLr   c                   "   V P                   P                  R 4      ;_uu_4       GRj  xL
 pVP                  4       G Rj  xL
 pTuuRRR4      GRj  xL
  #  L0 L L	  + GRj  xL 
 '       g   i     R# ; i5i)zhttps://python.orgN)r  postjson)r    responsevals   &  r   r   +AsyncContextManagerTest.ProductionCode.mainq  sM     ||(()=>>>($MMO+ ?>>+ ?>>>s\   (A>AA>A!AA!A>AA>A!A>!A;	'A*(
A;	3A;	5	A>r  N)r2   r3   r4   r5   r!   r   r8   r9   r:   s   @r   ProductionCoder  l  s     	 	 	r   r'  c                   a  V 3R  lp\         \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                 H  < SP                  4       p\        R R7      Vn        V ! RR7      p\        RR7      p\        R^{/R7      Vn        W2P
                  n        W!P                  P                  n        \        VP                  4       4      pSP                  VR^{/4       R# )sessionmocknamemagic_cmr$  r#  r   N)r'  r   r  r   r#  r  r   r"  r   r   r   )r  pcr  r$  r  r    s   &    r   r  KAsyncContextManagerTest.test_set_return_value_of_aenter.<locals>.inner_testw  s|    $$&B"6BJ
+B j1H%FC=AHM)1MM&+-JJOO(^FVfc]3r   z%test set return value of aenter with Nr   r"  s   f  r   test_set_return_value_of_aenter7AsyncContextManagerTest.test_set_return_value_of_aenterv  sK    		4 $Y/I Ei[QRR9% SR 0RRRr%  c                   a  V 3R  lp\         \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                   <aa R oSP                  4       pV ! V4      oVV3R lp\        V! 4       4      pSP                  S4       SP                  SP                  P                  4       SP                  SP
                  P                  4       SP                  P                  4        SP
                  P                  4        SP                  SV4       R# )Fc                     <"   S;_uu_4       GR j  xL
 p RoR R R 4      GR j  xL
  V #  L L  + GR j  xL 
 '       g   i     X # ; i5i)NTr   )r  calledcm_mocks    r   use_context_managerqAsyncContextManagerTest.test_mock_supports_async_context_manager.<locals>.inner_test.<locals>.use_context_manager  s0     "77f!F #7 #777s?   A+A/A-AAA		8
A		A			AN)r  r   r[   r  r5  r  r   assertIsNot)r  r  r7  	cm_resultr5  r6  r    s   &   @@r   r  TAsyncContextManagerTest.test_mock_supports_async_context_manager.<locals>.inner_test  s    F--/BmG /12IOOF#OOG..556OOG--445--/,,.Wi0r   z!test context manager magics with Nr   r"  s   f  r   (test_mock_supports_async_context_manager@AsyncContextManagerTest.test_mock_supports_async_context_manager  sK    	1( $Y/I A)MNN9% ON 0NNNr%  c                   a V P                  4       p\        V4      o\        4       pVSP                  n        V3R  lpV P                  \        V! 4       4      V4       R# )c                     <"   S;_uu_4       GR j  xL
 p T uuR R R 4      GR j  xL
  #  L L  + GR j  xL 
 '       g   i     R # ; i5ir   r   )r  mock_instances    r   r7  ^AsyncContextManagerTest.test_mock_customize_async_context_manager.<locals>.use_context_manager  s#     $}} %}}}}}}s?   A+A/A-AAA		8
A		A			AN)r  r   rc   r  r   r  r   )r    r   expected_resultr7  r@  s   &   @r   )test_mock_customize_async_context_managerAAsyncContextManagerTest.test_mock_customize_async_context_manager  sN    //1!(+ (0?  -	 	c-/0/Br   c                   aaa R oR oV3R lpV3R lpV P                  4       p\        V4      oVSn        VSn        V3R lp\	        V! 4       4       V P                  S4       V P                  S4       R# )Fc                     <"   R oR# 5iTNr   )r  enter_calleds   *r   enter_coroutineiAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.enter_coroutine  s     Lr  c                     <"   R oR# 5irG  r   )r  exit_calleds   *r   exit_coroutinehAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.exit_coroutine  s     Kr  c                     <"   S ;_uu_4       GR j  xL
   R R R 4      GR j  xL
  R #  L L  + GR j  xL 
 '       g   i     R # ; i5ir   r   )r@  s   r   r7  mAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine.<locals>.use_context_manager  s     $}} %}}}}}s?   A*A.A,AAA	7
A	 A		AN)r  r   r  r  r   r[   )r    rI  rM  r   r7  rH  rL  r@  s   &    @@@r   8test_mock_customize_async_context_manager_with_coroutinePAsyncContextManagerTest.test_mock_customize_async_context_manager_with_coroutine  sl    	 	 //1!(+#2 "0	 	!"%$r   c                    R  pV P                  4       p\        V4      pV P                  \        4      ;_uu_ 4        \	        V! V4      4       RRR4       R#   + '       g   i     R# ; i)c                    "   T ;_uu_4       GR j  xL
  \        4       h L  + GR j  xL 
 '       g   i     R # ; i5ir   )r  )context_managers   &r   raise_inYAsyncContextManagerTest.test_context_manager_raise_exception_by_default.<locals>.raise_in  s     &k! 's(   ? ?"?<	+
<	<		?N)r  r   r   r  r   )r    rV  r   r@  s   &   r   /test_context_manager_raise_exception_by_defaultGAsyncContextManagerTest.test_context_manager_raise_exception_by_default  sN    	" //1!(+y))'( *)))s   AA)	r   N)r2   r3   r4   r5   r  r  r'  r0  r<  rC  rQ  rX  r8   r9   r:   s   @r   r	  r	  `  sB     9 9
2 2
 & &4C%4) )r   r	  c                   H   a  ] tR tRt o  ! R R]4      tR tR tR tRt	V t
R# )	AsyncIteratorTesti  c                   2   a  ] tR tRt o R tR tR tRtV tR# )#AsyncIteratorTest.WithAsyncIteratori  c                    . ROV n         R# )r   N)r   	NormalFoobazitemsr   s   &r   r!   ,AsyncIteratorTest.WithAsyncIterator.__init__  s	    4DJr   c                    R # r   r   r   s   &r   r  -AsyncIteratorTest.WithAsyncIterator.__aiter__  r*   r   c                   "   R # 5ir   r   r   s   &r   r  -AsyncIteratorTest.WithAsyncIterator.__anext__  s     4r&   ra  N)	r2   r3   r4   r5   r!   r  r  r8   r9   r:   s   @r   WithAsyncIteratorr]    s     	5 	"''r   rh  c                   a \        R R7      o. ROSP                  n        V3R lp\        V! 4       4      pV P	                  V. RO4       R# )testerr+  c                  F   <"   S U u. u R j  xL
 q NK   LDup # u up i 5ir   r   )i	mock_iters    r   r   ;AsyncIteratorTest.test_aiter_set_return_value.<locals>.main  s     %.//A///s$   !
!Nr  )r   r  r   r   r   )r    r   r  rm  s   &  @r   test_aiter_set_return_value-AsyncIteratorTest.test_aiter_set_return_value  s;    8,	+4	(	0TV+r   c                   a  V 3R  lp\         \        3 F0  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       K2  	  R#   + '       g   i     KG  ; i)c                   < SP                  4       pV ! V4      pSP                  \        P                  ! VP                  4      4       SP                  \        P                  ! VP                  4      4       SP                  \        P                  ! VP                  4      4       SP                  \        P                  ! VP                  4      4       R # r   )rh  r]  r\   r]   r  r[   r  )r  r   r@  r    s   &  r   r  IAsyncIteratorTest.test_mock_aiter_and_anext_asyncmock.<locals>.inner_test  s    --/H%h/M W889K9KLMW889P9PQROOG778J8JKLOOG778O8OPQr   z%test aiter and anext corourtine with Nr   r"  s   f  r   #test_mock_aiter_and_anext_asyncmock5AsyncIteratorTest.test_mock_aiter_and_anext_asyncmock  sL    		R $Y/I Ei[QRR9% SR 0RRRr%  c                  a aa R  o. ROoVV 3R lpVVV 3R lpVVV 3R lp\         \        3 F  pS P                  RV 24      ;_uu_ 4        V! V4       RRR4       S P                  RV 24      ;_uu_ 4        V! V4       RRR4       S P                  RV 24      ;_uu_ 4        V! V4       RRR4       K  	  R#   + '       g   i     Lp; i  + '       g   i     LV; i  + '       g   i     K  ; i)	c                 V   "   . pV   R j  xL
  pVP                  V4       K   LDT# 5ir   )append)iteratoraccumulatorr  s   &  r   iterate6AsyncIteratorTest.test_mock_async_for.<locals>.iterate  s6     K& ) )d""4()h s   )&$&)&)c                 v   < V ! SP                  4       4      pSP                  \        S! V4      4      . 4       R # r   )rh  r   r   )r  r@  r{  r    s   & r   test_default;AsyncIteratorTest.test_mock_async_for.<locals>.test_default  s0    %d&<&<&>?MS!78"=r   c                    < V ! SP                  4       4      pSR ,          VP                  n        SP                  \	        S! V4      4      S4       R# :NNNN)rh  r  r   r   r   r  r@  expectedr{  r    s   & r   test_set_return_valueDAsyncIteratorTest.test_mock_async_for.<locals>.test_set_return_value  sB    %d&<&<&>?M3;A;M##0S!78(Cr   c                    < V ! SP                  4       4      p\        SR ,          4      VP                  n        SP	                  \        S! V4      4      S4       R# r  )rh  iterr  r   r   r   r  s   & r   test_set_return_value_iterIAsyncIteratorTest.test_mock_async_for.<locals>.test_set_return_value_iter  sG    %d&<&<&>?M373DM##0S!78(Cr   zdefault value with Nzset return_value with zset return_value iterator with )FOOBARBAZr   )r    r~  r  r  r  r  r{  s   f    @@r   test_mock_async_for%AsyncIteratorTest.test_mock_async_for  s    	 )	>
	D
	D
 $Y/I 3I;?@@Y' A  6ykBCC%i0 D  ?	{KLL*95 ML 0@@ DC MLLs$   	B>:	C'	C$>CC!$C5r   N)r2   r3   r4   r5   rc   rh  ro  rt  r  r8   r9   r:   s   @r   r[  r[    s%     (F (,&" 6  6r   r[  c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )AsyncMockAsserti  c                $    \        4       V n        R # r   )r   r   r   s   &r   setUpAsyncMockAssert.setUp  s    K	r   c                F   "   V P                   ! V/ VB G R j  xL
  R #  L5ir   r   r  s   &*,r   _runnable_testAsyncMockAssert._runnable_test  s     ii((((s   !!c                "   "   VG R j  xL
 #  L5ir   r   )r    	coroutines   &&r   _await_coroutine AsyncMockAssert._await_coroutine  s     s   c                   \        \        4      p\        V 4      ;_uu_ 4        VP                  4        R R R 4       V P	                  \
        P                  ! VP                  4      4       VP                  P                  4        VP                  P                  4        VP                  P                  4        V P                  \        4      ;_uu_ 4        VP                  4        R R R 4       V P                  \        4      ;_uu_ 4        VP                  P                  4        R R R 4       R #   + '       g   i     EL; i  + '       g   i     Lf; i  + '       g   i     R # ; ir   )r   r   rV   r$   r[   r\   r]   assert_calledassert_called_onceassert_called_once_withr   r  r   r   s   & r   "test_assert_called_but_not_awaited2AsyncMockAssert.test_assert_called_but_not_awaited!  s    $%% &33D4E4EFG''),,.113~..! /~..,,. /. &%% /....s#   D1EE1E	E	E)	c                   \        \        4      pVP                  4       pVP                  P                  4        VP                  P	                  4        VP                  P                  4        V P                  \        4      ;_uu_ 4        VP                  P                  4        R R R 4       \        V P                  V4      4       VP                  P	                  4        VP                  P                  4        VP                  P                  4        VP                  P                  4        R #   + '       g   i     L; ir   )r   r   r$   r  r  r  r   r  r   r   r  r  r  )r    r   mock_coroutines   &  r   test_assert_called_then_awaited/AsyncMockAssert.test_assert_called_then_awaited.  s    $**,''),,.113~..,,. / 	D!!.12,,.((*--/224 /.s   D22E	c                   V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       V P                  \        4      ;_uu_ 4        V P                  P	                  4        R R R 4       \        V P                  4       4       V P                  P                  4        V P                  P                  4        R #   + '       g   i     L; i  + '       g   i     Lr; ir   )	r   r  r   r   r  r   r  r  r  r   s   &r   +test_assert_called_and_awaited_at_same_time;AsyncMockAssert.test_assert_called_and_awaited_at_same_time>  s    ~..II$$& / ~..II##% / 	D!"		$$&		%%' /. /.s   CC#C 	#C3	c                8   \        \        4      pVP                  4       p\        V 4      ;_uu_ 4        VP                  4        R R R 4       V P	                  \
        4      ;_uu_ 4        VP                  P                  4        R R R 4       VP                  P                  4        \        V P                  V4      4       VP                  P                  4        VP                  P                  4        R #   + '       g   i     L; i  + '       g   i     L; ir   )r   r   r$   rV   r   r  r   r  r   r  r  r    r   r  s   &  r   )test_assert_called_twice_and_awaited_once9AsyncMockAssert.test_assert_called_twice_and_awaited_onceI  s    $%%'	  %% &~..,,. /'')D!!),-((*--/ &%..s   C6)D	6D		D	c                   \        \        4      pVP                  4       pVP                  P                  4        \	        V P                  V4      4       V P                  \        4      ;_uu_ 4        \	        V P                  V4      4       R R R 4       VP                  P                  4        R #   + '       g   i     L,; ir   )	r   r   r$   r  r   r  r   r   r   r  s   &  r   )test_assert_called_once_and_awaited_twice9AsyncMockAssert.test_assert_called_once_and_awaited_twiceW  s    $%%'	,,.D!!),-|,,%%i01 - 	((* -,s   1B00C 	c                \   V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       V P                  \        4      ;_uu_ 4        V P                  P	                  4        R R R 4       V P                  \
        4      ;_uu_ 4        \        V P                  V P                  4      4       R R R 4       V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       V P                  \        4      ;_uu_ 4        V P                  P	                  4        R R R 4       R #   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R # ; ir   )r   r  r   r   r  r  r   r  r   s   &r   "test_assert_awaited_but_not_called2AsyncMockAssert.test_assert_awaited_but_not_calleda  s    ~..II$$& /~..II##% /y))%%dii01 * ~..II$$& /~..II##% /. /....)) /....s;   EE!%E4(F(FE	!E1	4F	F	F+	c                ~   \        R 4      .p\        V 4      ;_uu_ 4        V P                  R 4       RRR4       V P                  P                  V4       V P	                  \
        4      ;_uu_ 4        V P                  P                  V4       RRR4       R#   + '       g   i     Ln; i  + '       g   i     R# ; ir   N)r
   rV   r   assert_has_callsr   r  r  )r    kallss   & r    test_assert_has_calls_not_awaits0AsyncMockAssert.test_assert_has_calls_not_awaitso  s{    e%%IIe &		""5)~..II''. /. &% /..s   B2B+B(	+B<	c                f   \        V 4      ;_uu_ 4        V P                  4        R R R 4       RR/ 3.pV P                  V P                  P                  V4       \        V 4      ;_uu_ 4        V P                  R4       R R R 4       \        V 4      ;_uu_ 4        V P                  R4       R R R 4       \	        4       \	        R4      \	        R4      .pV P                  V P                  P                  V4       R #   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L}; i)N r   r`  r   )rV   r   r   r  r
   )r    kalls_empty
mock_kallss   &  r   0test_assert_has_mock_calls_on_async_mock_no_spec@AsyncMockAssert.test_assert_has_mock_calls_on_async_mock_no_specw  s    %%IIK &B|n--{;%%IIe &%%IIe &vtE{DK8
--z: &%
 &%%%s#   C:,DD :D
	D	 D0	c           
        \        \        4      p\        V 4      ;_uu_ 4        VP                  4        R R R 4       RR/ 3.pV P	                  VP                  P
                  V4       V P	                  VP
                  \        P                  ! 4       .4       \        V 4      ;_uu_ 4        VP                  ^^^^^R7       R R R 4       \        4       \        ^^^^^R7      .p\        P                  ! 4       \        P                  ! ^^^^^R7      .pV P	                  VP                  P
                  V4       V P	                  VP
                  V4       R #   + '       g   i     EL-; i  + '       g   i     L; i)Nr  )rD   rE   r   )r   r   rV   r$   r   r  r
   )r    a_class_mockr  method_kallsr  s   &    r   2test_assert_has_mock_calls_on_async_mock_with_specBAsyncMockAssert.test_assert_has_mock_calls_on_async_mock_with_spec  s"    ,%%%%' &B|n22=={K0043D3D3F2GH%%%%aAa%8 &Q1Q 78'')4+<+<Q1Q+OP
22==|L00*= &%% &%s   E+E,E)	,E<	c                r   \        V 4      ;_uu_ 4        V P                  P                  ^RR7       RRR4       \        V 4      ;_uu_ 4        V P                  P                  P                  ^\        P
                  R7       RRR4       V P                  V P                  P                  RR	RR/3RR
R\        P
                  /3.R4       V P                  V P                  P                  P                  RR
R\        P
                  /3.R4       R#   + '       g   i     L; i  + '       g   i     L; i)r  N)fish)cake	somethingr  zsomething_else.somethingr  z#method calls not recorded correctly)r  )   )rV   r   r  something_elser   Caker   method_callsr   s   &r    test_async_method_calls_recorded0AsyncMockAssert.test_async_method_calls_recorded  s    %%II- &%%II$$..qx}}.E & 	//$/'/FG2
 2		3
 	11>>&vx}}.EFG>	@ &%%%s   D6D&D#	&D6	c                f  a  V 3R  lpV! S P                   4       \        S 4      ;_uu_ 4        S P                  4        RRR4       \        S 4      ;_uu_ 4        S P                  ^^4       RRR4       \        S 4      ;_uu_ 4        S P                  ^R7       RRR4       S P                   P                  4        V! S P                   4       \        \        4      p\        S 4      ;_uu_ 4        VP                  4        RRR4       \        S 4      ;_uu_ 4        VP                  ^^R7       RRR4       VP                  4        V! V4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lx; i)c                    < RpV FL  p\        W4      pSP                  V\        4       SP                  V\        4       SP	                  V. 4       KN  	  R# )r  N)r  r  r  )getattrrx   r   listr   )r   namesr,  attrr    s   &   r   assert_attrs:AsyncMockAssert.test_async_arg_lists.<locals>.assert_attrs  sL    DEt*%%dI6%%dD1  r*	 r   N)rD   )r   rV   r  r   r   r$   )r    r  r  s   f  r   test_async_arg_lists$AsyncMockAssert.test_async_arg_lists  s   	+ 	TYY%%IIK &%%IIaO &%%IIIN & 			TYY:&%%! &%%Q' & 	V# &%%%%%%% &%%%s;   EE&E:0FF E#	&E7	:F
	F	 F0	c                   V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       \	        V P                  4       4       V P                  P                  4        R #   + '       g   i     LE; ir   )r   r  r   r   r   r  r   s   &r   test_assert_awaited#AsyncMockAssert.test_assert_awaited  sT    ~..II$$& / 	D!"		  "	 /.s   A66B	c                   V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       \	        V P                  4       4       V P                  P                  4        \	        V P                  4       4       V P                  \        4      ;_uu_ 4        V P                  P                  4        R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; ir   )r   r  r   r  r   r  r   s   &r   test_assert_awaited_once(AsyncMockAssert.test_assert_awaited_once  s    ~..II))+ / 	D!"		%%'D!"~..II))+ /. /. /..s   C*C"C	"C3	c                   R pV P                  \        V4      ;_uu_ 4        V P                  P                  R4       RRR4       \	        V P                  4       4       RpV P                  \        V4      ;_uu_ 4        V P                  P                  R4       RRR4       \	        V P                  R4      4       V P                  P                  R4       \	        V P                  R4      4       V P                  \        4      ;_uu_ 4        V P                  P                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)zNot awaitedr   Nzexpected await not foundSomethingElse)r  r  r   r  r   r  r   )r    msgs   & r   test_assert_awaited_with(AsyncMockAssert.test_assert_awaited_with  s    ##NC88II))%0 9 	D!"(##NC88II))%0 9 	D&'		%%e,D01~..II))%0 /. 98
 98 /..s#   D4>EE4E	E	E+	c                   V P                  \        4      ;_uu_ 4        V P                  P                  R 4       RRR4       \	        V P                  R 4      4       V P                  P                  R 4       \	        V P                  R 4      4       V P                  \        4      ;_uu_ 4        V P                  P                  R 4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir  )r   r  r   r  r   r  r   s   &r   test_assert_awaited_once_with-AsyncMockAssert.test_assert_awaited_once_with  s    ~..II..u5 / 	D&'		**51D&'~..II..u5 /. /. /..s   C.C'C$	'C8	c                ^   V P                  \        4      ;_uu_ 4        V P                  P                  R 4       RRR4       \	        V P                  R4      4       V P                  \        4      ;_uu_ 4        V P                  P                  R 4       RRR4       \	        V P                  R 4      4       V P                  P                  R 4       \	        V P                  R4      4       V P                  P                  R 4       R#   + '       g   i     L; i  + '       g   i     L; i)r   Nr`  r  )r   r  r   r  r   r  r   s   &r   test_assert_any_wait$AsyncMockAssert.test_assert_any_wait  s    ~..II&&u- / 	D&'~..II&&u- / 	D&'		""5)D01		""5) /. /.s   D	9D	D	D,	c                   \        R 4      \        R4      .pV P                  \        4      ;_uu_ 4       pV P                  P	                  V4       RRR4       V P                  \        XP                  P                  4      ^4       \        V P                  R 4      4       V P                  \        4      ;_uu_ 4        V P                  P	                  V4       RRR4       \        V P                  R 4      4       V P                  \        4      ;_uu_ 4        V P                  P	                  V4       RRR4       \        V P                  R4      4       V P                  P	                  V4       \        V P                  R4      4       V P                  P	                  V4       R#   + '       g   i     ELb; i  + '       g   i     L; i  + '       g   i     L; i)r   r`  Nr  )r
   r   r  r   r  r   len	exceptionr  r   r  )r    callsr  s   &  r   test_assert_has_awaits_no_order/AsyncMockAssert.test_assert_has_awaits_no_order  s?   ed5k*~.."II''. /R\\../3D&'~..II''. / 	D&'~..II''. / 	D&'		##E*D01		##E*! /..
 /. /.s#   F)>F=G)F:	=G	G 	c                .    ! R  R4      p\        V P                  V! 4       ^4      4       V P                  P                  \	        \
        ^4      .4       V P                  P                  \
        ^4       V P                  P                  \
        ^4       R# )c                   &   a  ] tR tRt o R tRtV tR# )9AsyncMockAssert.test_awaits_asserts_with_any.<locals>.Fooi  c                    R # r   r   r    others   &&r   __eq__@AsyncMockAssert.test_awaits_asserts_with_any.<locals>.Foo.__eq__      Tr   r   Nr2   r3   r4   r5   r  r8   r9   r:   s   @r   Foor         ))r   r  N)r   r  r   r  r
   r	   r  r  )r    r  s   & r   test_awaits_asserts_with_any,AsyncMockAssert.test_awaits_asserts_with_any  sg    	* 	* 	Dq)*		##T#q\N3		%%c1-		""3*r   c                  a  ! R  R4      p\        VR7      oV3R lp\        V! V! 4       ^4      4       SP                  \        \        ^4      .4       SP                  \        ^4       SP                  \        ^4       R# )c                   &   a  ] tR tRt o R tRtV tR# )BAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>.Fooi  c                    R # r   r   r  s   &&r   r  IAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>.Foo.__eq__  r  r   r   Nr  r:   s   @r   r  r    r  r   r  r;  c                  0   <"   S! V !  G R j  xL
  R #  L5ir   r   )r  mock_with_specs   *r   _custom_mock_runnable_testYAsyncMockAssert.test_awaits_asserts_with_spec_and_any.<locals>._custom_mock_runnable_test   s      $'''s   
N)r   r   r  r
   r	   r  r  )r    r  r  r  s   &  @r   %test_awaits_asserts_with_spec_and_any5AsyncMockAssert.test_awaits_asserts_with_spec_and_any  sh    	* 	* #,	( 	&sua01(($sA,8**32''Q/r   c                |   \        R 4      \        R4      .pV P                  \        4      ;_uu_ 4        V P                  P	                  VRR7       RRR4       \        V P                  R4      4       V P                  \        4      ;_uu_ 4        V P                  P	                  VRR7       RRR4       \        V P                  R4      4       V P                  \        4      ;_uu_ 4        V P                  P	                  VRR7       RRR4       \        V P                  R 4      4       V P                  P	                  VRR7       \        V P                  R4      4       V P                  P	                  VRR7       R#   + '       g   i     EL;; i  + '       g   i     L; i  + '       g   i     L; i)r   r`  T)	any_orderNbamfqux)r
   r   r  r   r  r   r  )r    r  s   & r   test_assert_has_awaits_ordered.AsyncMockAssert.test_assert_has_awaits_ordered(  s9   ed5k*~..II'''> / 	D&'~..II'''> / 	D'(~..II'''> / 	D&'		##ET#:D&'		##ET#: /.. /. /.s#   FF.F+F	F(	+F;	c                   V P                   P                  4        \        V P                  4       4       V P	                  \
        4      ;_uu_ 4        V P                   P                  4        R R R 4       R #   + '       g   i     R # ; ir   )r   r   r   r  r   r  r   s   &r   test_assert_not_awaited'AsyncMockAssert.test_assert_not_awaited;  sS    		$$&D!"~..II((* /...s   A66B	c           	        RR lp\        VR7      V n        \        V P                  ^4      4       V P	                  \
        RP                  \        P                  ! R4      4      4      ;_uu_ 4       pV P                  P                  \        4       .4       R R R 4       V P                  XP                  P                  4       V P	                  \
        RP                  \        P                  ! R4      4      4      ;_uu_ 4       pV P                  P                  \        4       \        ^^4      .4       R R R 4       V P                  VP                  P                  \        4       R #   + '       g   i     L; i  + '       g   i     LO; i)Nc                    "   R # 5ir   r   r  s   &r   fIAsyncMockAssert.test_assert_has_awaits_not_matching_spec_error.<locals>.fC  s     Tr&   r;  z^{}$z6Awaits not found.
Expected: [call()]
Actual: [call(1)]zError processing expected awaits.
Errors: [None, TypeError('too many positional arguments')]
Expected: [call(), call(1, 2)]
Actual: [call(1)]r   )r   r   r   r  r  r  formatreescaper  r
   r   r  	__cause__rx   r  )r    r  r  s   &  r   .test_assert_has_awaits_not_matching_spec_error>AsyncMockAssert.test_assert_has_awaits_not_matching_spec_errorB  s   !1%	D"###II 2 345 5
 9;II''15 	",,001##II,-./ / 35II''a(<=/ 	bll44i@'5 5/ /s   2%E)0E<)E9	<F	r  N)r2   r3   r4   r5   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r8   r9   r:   s   @r   r  r    s      )/5 	(0+&/;>@:#	,1"	6*+*+0;&+A Ar   r  __main__)0r   rS   r\   r  unittest
contextlibr   rU   r   requires_working_socketr   r   unittest.mockr	   r
   r   r   r   r   r   r   r   r   r   r   r=   rB   rG   rJ   rc   rM   r2   rr   rn  rV   TestCaserX   r   r   r   r  rr  r  r  r	  r[  r  r   r   r   r   <module>r!     s    	  	  %    t ,  ,G G G0	* 	*   + &  :[)Jl+  :Ah// :Az/x(( /d4H%% 4>b)) bJs+H%% s+l1x(( 18wH, wHt$G)) $GLo)h// o)dB6)) B6JDAh'' DAN
 zMMO r   