
    p[im                     6   d dl Z d dlZd dlZd dlmZ d dlmZ d dlZddlmZ ddlm	Z	 ddlm
Z
 	 d dlm
Z d d	lmZ  ej$                  e e             ZdZdZdededefdZdedefdZdedefdZdedededefdZdedefdZ d Z!d Z"d Z#d  Z$d! Z%d" Z&d# Z'd$ Z(d% Z)d& Z*d' Z+d( Z,d) Z-ej\                  j_                  ej"                  d*k\  d+,      d-        Z0ej\                  j_                  ej"                  d*k\  d+,      d.        Z1d/ Z2ej\                  jf                  d0        Z4ej\                  jf                  d1        Z5d2 Z6d3 Z7d4 Z8d5 Z9d6 Z:d7 Z;ej\                  jf                  d8        Z<ej\                  jf                  d9        Z=ej\                  jf                  d:        Z>ej\                  jf                  d;        Z?ej\                  jf                  d<        Z@ej\                  jf                  d=        ZAej\                  jf                  d>        ZBej\                  jf                  d?        ZCej\                  jf                  d@        ZDej\                  jf                  dA        ZEej\                  jf                  dB        ZFdC ZGdD ZHej\                  jf                  dE        ZIej\                  jf                  dF        ZJdG ZKdH ZLej\                  jf                  dI        ZMy# e$ r#Zd dlZej"                  d
k  r	 ed      eedZ[ww xY w)J    N)	BaseModel)ValidationError   )pytest_helper   )errors)types)ClientSession)r   
   zKMCP Tool requires Python 3.10 or above. Please upgrade your Python version.)fileglobals_for_file)pytest_asynciogemini-2.5-flash	numeratordenominatorreturnc                     | |z  dz   S )z/Divides two integers with customized math rule.    r   r   s     c/mnt/data/GridWatch/venv/lib/python3.12/site-packages/google/genai/tests/chats/test_send_message.py*divide_intergers_with_customized_math_ruler   4   s     
k	!A	%%    given_integerc                     | | z  S )Nr   )r   s    r   square_integerr   ;   s    	}	$$r   powerc                 (    t        d| rdnd        y)zPowers the spinning disco ball.zDisco ball is z	spinning!zstopped.Tprint)r   s    r   power_disco_ballr!   ?   s    	N%;Z@
ABr   	energeticloudbpmc                 ,    t        d| d|d|       y)a  Play some music matching the specified parameters.

    Args:
      energetic: Whether the music is energetic or not.
      loud: Whether the music is loud or not.
      bpm: The beats per minute of the music.

    Returns: The name of the song being played.
    zStarting music! energetic=z loud=z, bpm=zNever gonna give you up.r   )r"   r#   r$   s      r   start_musicr&   D   s#     
'YL$3&
9:%r   
brightnessc                 "    t        d| d       y)zhDim the lights.

    Args:
      brightness: The brightness of the lights, 0.0 is off, 1.0 is full.
    zLights are now set to z.0%Tr   )r'   s    r   
dim_lightsr)   Q   s     
":c"2
34r   c                 f    | j                   j                  t              }|j                  d       y Nmodeltell me a story in 100 wordschatscreate
MODEL_NAMEsend_messageclientchats     r   	test_textr7   Z   s*    			:		.$$r   c                     | j                   j                  t              }|j                  t        j
                  j                  d             y Nr,   r.   textr0   r1   r2   r3   r	   Part	from_textr4   s     r   	test_partr?   a   s=    			:		.$jj >?r   c                     | j                   j                  t              }|j                  t        j
                  j                  d      t        j
                  j                  d      g       y Nr,   ztell me a US cityr:   zthe city is in west coastr<   r4   s     r   
test_partsrB   h   sX    			:		.$
**

$7

8
**

$?

@r   c                 j    | j                   j                  t              }|j                  d|g       y )Nr,   what is the image about?r/   )r5   
image_jpegr6   s      r   
test_imagerF   r   s2    			:		.$
$
r   c                    | j                   j                  t        ddddi      }|j                  d      }d}|j                  r<|j                  D ]-  }|j
                  j                  D ]  }|j                  sd} - / |sJ |j                  d      }d}|j                  r<|j                  D ]-  }|j
                  j                  D ]  }|j                  sd} - / |sJ y	)
CTests that the thinking budget is respected and generates thoughts.thinking_configT'  include_thoughtsthinking_budgetr-   config1what is the sum of natural numbers from 1 to 100?F/can you help me to understand the logic better?N)r0   r1   r2   r3   
candidatescontentpartsthought)r5   r6   	response1has_thought1	candidatepart	response2has_thought2s           r   test_thinking_budgetr\   |   s   			
#'!& 
 
$ 9) ,)) 	##)) $<<,

 
7) ,)) 	##)) $<<,

 
r   c                    | j                   j                  t        ddddi      }d}|j                  d      D ]K  }|j                  s|j                  D ]-  }|j
                  j                  D ]  }|j                  sd} - / M |sJ d}|j                  d      D ]K  }|j                  s|j                  D ]-  }|j
                  j                  D ]  }|j                  sd} - / M |sJ y	)
rH   rI   TrJ   rK   rN   FrP   rQ   N)r0   r1   r2   send_message_streamrR   rS   rT   rU   )r5   r6   rW   chunkrX   rY   r[   s          r   test_thinking_budget_streamr`      s   			
"&!& 
 
$ ,''9 e '' )%%++ 	D\\L		 
,''7 e '' )%%++ 	D\\L		 
r   c                    | j                   j                  t              }t        j                  | t
        j                        5  |j                  dt        j                  j                  dd      g       d d d        y # 1 sw Y   y xY w)Nr,   rD   z5gs://unified-genai-dev/imagen-inputs/google_small.png	image/pngfile_uri	mime_type)r0   r1   r2   r   exception_if_mldevr   ClientErrorr3   r	   r=   from_urir4   s     r   test_google_cloud_storage_uriri      sw    			:		.$''0B0BC 	&JJP%   	
	 	 	   3BB
c                    | j                   j                  t              }t        j                  | t
        j                        5  |j                  dt        j                  j                  dd      g       d d d        y # 1 sw Y   y xY w)Nr,   rD   zChttps://generativelanguage.googleapis.com/v1beta/files/az606f58k7zjrb   rc   )r0   r1   r2   r   exception_if_vertexr   rg   r3   r	   r=   rh   r4   s     r   test_uploaded_file_urirm      sw    			:		.$((1C1CD 	&JJ^%   	
	 	 	rj   c                    ddi}| j                   j                  t        |      }ddi}|j                  d|      }|j                  d      }t	        |j
                        dk(  sJ t	        |j
                        dk(  sJ y Ncandidate_countr   rN   r   r.   rO   )r0   r1   r2   r3   lenrR   r5   chat_configr6   request_configrequest_config_responsedefault_config_responses         r   test_config_overriderx      s    "A&+			:k		B$%q). --$ .  !--$& 
$//	0A	55	5	$//	0A	55	5r   c                 |   t        j                  dt         j                  j                  d      g      t        j                  dt         j                  j                  d      g      g}| j                  j                  t        |      }|j                  d       t        |j                               d	kD  sJ y 
Nuserzdefine a=5, b=10r:   )rolerT   r-   z Hello there! how can I help you?)r-   historyzwhat is a + b?r   )
r	   Contentr=   r>   r0   r1   r2   r3   rr   get_historyr5   r}   r6   s      r   test_historyr      s    mmejj228J2KL mm%%+M%NO	' 
		:w		?$$%	T	 1	$$	$r   c                     | j                   j                  t              }|j                  d       |j                  d       y Nr,   z9write a python function to check if a year is a leap yearz"write a unit test for the functionr/   r4   s     r   test_send_2_messagesr      s7    			:		.$OP89r   c                 2   | j                   j                  ddt        gi      }|j                  d      }|j	                         }t        |      dk(  sJ |d   j                  dk(  sJ |d   j                  d   j                  dk(  sJ |d   j                  d	k(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  dddk(  sJ |d   j                  dk(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  ddik(  sJ |d   j                  d	k(  sJ d|d   j                  d   j                  v sJ y Ngemini-2.0-flash-exptoolsrN   what is the result of 100/2?   r   r{   r   r-   r   d   r   r   result3   r   51)r0   r1   r   r3   r   rr   r|   rT   r;   function_callnameargsfunction_responseresponser5   r6   _chat_historys       r   test_with_afc_historyr     s   			"BCD 
 
$ 67!!!#,	\	a			a			''	'	a		q	!	&	&*H	HH	H	a			((	(1oA,,11	566 
a		q	!	/	/	4	49 
  

 
a			''	'1oA0055	566 
a		q	!	3	3	<	<2	NN	N	a			((	(	a&&q)..	..	.r   c                 f   | j                   j                  ddt        gi      }|j                  d      }|j                  d      }|j                  d      }|j	                         }g }|D ]!  }|j                  |j                                # t        |      t        t        |            k(  sJ y )Nr   r   rN   helloz&could you help me with a math problem?r   )	r0   r1   r   r3   r   appendmodel_dump_jsonrr   set)r5   r6   r   r   content_stringsrS   s         r   .test_existing_chat_history_extends_afc_historyr   %  s    			"BCD 
 
$  !
@A!
67!!!#,/ 6g722456 
_	S%9!:	::	:r   )r      zVobject type is dumped as <Type.OBJECT: "OBJECT"> as opposed to "OBJECT" in Python 3.13)reasonc                    t         t        t        g}|dddiiddid}| j                  j	                  t
        |      }|j                  d       |j                         }t        |      d	k(  sJ |d
   j                  dk(  sJ |d
   j                  d
   j                  dk(  sJ |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  y Nfunction_calling_configmodeANYmaximum_remote_callsr   )r   tool_configautomatic_function_callingrN   zTurn this place into a party!   r   r{   r   r-   r   r            r!   r&   r)   r0   r1   r2   r3   r   rr   r|   rT   r;   r   r   r5   	house_fnsrO   r6   curated_historyrY   s         r   #test_with_afc_multiple_remote_callsr   6  c     j9) $e& !!%& 
		:f		=$34$$&/	_		""	"			 	 F	**	*			!	!!	$	)	)-L	LL	L			 	 G	++	+	_Q%%	&!	++	+a && d			 	 F	**	*	_Q%%	&!	++	+a && "d!!!!"			 	 G	++	+	_Q%%	&!	++	+a && d			 	 F	**	*	_Q%%	&!	++	+a && "d!!!!"			 	 G	++	+	_Q%%	&!	++	+a && d			 	 F	**	*	_Q%%	&!	++	+a && "d!!!!"			 	 G	++	+	_Q%%	&!	++	+a && dr   c                    t         t        t        g}|dddiiddid}| j                  j	                  t
        |      }|j                  d       |j                         }t        |      d	k(  sJ |d
   j                  dk(  sJ |d
   j                  d
   j                  dk(  sJ |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  |d   j                  dk(  sJ t        |d   j                        dk(  sJ |d   j                  D ]  }|j                  rJ  y r   r   r   s         r   )test_with_afc_multiple_remote_calls_asyncr   q  r   r   c                    | j                   j                  dt        gddid      }|j                  d       |j	                         }t        |      dk(  sJ |d   j                  d	k(  sJ |d   j                  d   j                  dk(  sJ |d
   j                  dk(  sJ |d
   j                  d   j                  j                  dk(  sJ |d
   j                  d   j                  j                  ddik(  sJ y Nr   disableT)r   r   rN   zDo the square of 3.r   r   r{   r   r-   r   r   r   )r0   r1   r   r3   r   rr   r|   rT   r;   r   r   r   r5   r6   r   s      r   test_with_afc_disabledr     s   			""#)2D(9 
 
$  !!#,	\	a			a			''	'	a		q	!	&	&*?	??	?	a			((	(	a		q	!	/	/	4	48H	HH	H	a		q	!	/	/	4	4q9 
  
r   c                 d  K   | j                   j                  j                  ddt        gi      }|j	                  d       d {   }|j                         }t        |      dk(  sJ |d   j                  dk(  sJ |d   j                  d   j                  dk(  sJ |d   j                  d	k(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  dddk(  sJ |d   j                  dk(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  ddik(  sJ |d   j                  d	k(  sJ d|d   j                  d   j                  v sJ y 7 hwr   )aior0   r1   r   r3   r   rr   r|   rT   r;   r   r   r   r   r   r   s       r   test_with_afc_history_asyncr     s    				 	 "BCD 
! 
$ <==!!!#,	\	a			a			''	'	a		q	!	&	&*H	HH	H	a			((	(1oA,,11	566 
a		q	!	/	/	4	49 
  

 
a			''	'1oA0055	566 
a		q	!	3	3	<	<2	NN	N	a			((	(	a&&q)..	..	.3 >s   AF0F-E(F0c                 &  K   | j                   j                  j                  dt        gddid      }|j	                  d       d {    |j                         }t        |      dk(  sJ |d   j                  d	k(  sJ |d   j                  d   j                  dk(  sJ |d
   j                  dk(  sJ |d
   j                  d   j                  j                  dk(  sJ |d
   j                  d   j                  j                  ddik(  sJ y 7 ƭwr   )r   r0   r1   r   r3   r   rr   r|   rT   r;   r   r   r   r   s      r   test_with_afc_disabled_asyncr     s5    				 	 ""#)2D(9 
! 
$ 		   !!#,	\	a			a			''	'	a		q	!	&	&*?	??	?	a			((	(	a		q	!	/	/	4	48H	HH	H	a		q	!	/	/	4	4q9 
  
s   ADD	CDc                     | j                   j                  t              }d}|j                  d      D ]  }|dz  }	 |dkD  sJ y Nr,   r   r.   r   r0   r1   r2   r^   r5   r6   chunksr_   s       r   test_stream_textr     sT    			:		.$&''$ e aKF
 
!r   c                     | j                   j                  t              }d}|j                  t        j
                  j                  d            D ]  }|dz  }	 |dkD  sJ y Nr,   r   r.   r:   r   r0   r1   r2   r^   r	   r=   r>   r   s       r   test_stream_partr   	  sg    			:		.$&''jj >? e aKF
 
!r   c                    | j                   j                  t              }d}|j                  t        j
                  j                  d      t        j
                  j                  d      g      D ]  }|dz  }	 |dkD  sJ y )Nr,   r   r.   r:   the story is about a carr   r   r   r   s       r   test_stream_partsr     s    			:		.$&''
**

$B

C
**

$>

? e aKF 
!r   c                    ddi}| j                   j                  t        |      }ddi}d}|j                  d|      D ]  }||j                  z  } d}|j                  d      D ]  }||j                  z  } t        j                  |      sJ t        j                  t
        j                        5  t        j                  |       d d d        y # 1 sw Y   y xY w)Nresponse_mime_type
text/plainrN   application/json r.   rq   )
r0   r1   r2   r^   r;   jsonloadspytestraisesJSONDecodeErrorr5   rt   r6   ru   request_config_textr_   default_config_texts          r   test_stream_config_overrider   "  s    %|4+			:k		B$(*<=.''$^ (  &e 5::%& ''(FG &e5::%& 
'	((	(}}T))* $JJ"#$ $ $s   4CCc                    | j                   j                  ddt        gi      }|j                  d      D ]  } |j                  d      D ]  } |j	                         }|d   j
                  dk(  sJ |d   j                  d   j                  dk(  sJ |d   j
                  d	k(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  dddk(  sJ y Nr   r   rN   r   zwhat is the result of 50/2?r   r{   r   r-   r   r   r   r   )r0   r1   r   r^   r   r|   rT   r;   r   r   r   r5   r6   r_   r   s       r   test_stream_function_callingr   4  s@   			"BCD 
 
$
 ''$ 	e 		 ''# 	e 		 !!#,	a			''	'	a		q	!	&	&*H	HH	H	a			((	(1oA,,11	566 
a		q	!	/	/	4	49 
  
r   c                     | j                   j                  t              }|j                  d      D ]  } |j                  d      D ]  } y r   r   r5   r6   r_   s      r   test_stream_send_2_messagesr   R  s[    			:		.$''A 	e 		
 ''(LM 	e	r   c                    K   | j                   j                  j                  t              }|j	                  d       d {    y 7 wr+   )r   r0   r1   r2   r3   r4   s     r   test_async_textr   ]  s8     				 	 z	 	2$8999s   ?A	AA	c                    K   | j                   j                  j                  t              }|j	                  t
        j                  j                  d             d {    y 7 wr9   r   r0   r1   r2   r3   r	   r=   r>   r4   s     r   test_async_partr   c  sJ     				 	 z	 	2$%**..4R.STTTs   AA'A% A'c                   K   | j                   j                  j                  t              }|j	                  t
        j                  j                  d      t
        j                  j                  d      g       d {    y 7 wrA   r   r4   s     r   test_async_partsr   i  sl     				 	 z	 	2$
**

$7

8
**

$?

@	  s   A=B?B Bc                 J  K   ddi}| j                   j                  j                  t        |      }ddi}|j	                  d|       d {   }|j	                  d       d {   }t        |j                        dk(  sJ t        |j                        dk(  sJ y 7 R7 ;wro   )r   r0   r1   r2   r3   rr   rR   rs   s         r   test_async_config_overrider   t  s     "A&+				 	 z+	 	F$%q)."&"3"3$ #4 #  #'"3"3$#& & 
$//	0A	55	5	$//	0A	55	5&s$   A
B#BB#%B!&:B#!B#c                   K   t        j                  dt         j                  j                  d      g      t        j                  dt         j                  j                  d      g      g}| j                  j
                  j                  t        |      }|j                  d       d {    t        |j                               d	kD  sJ y 7 #wrz   )r	   r~   r=   r>   r   r0   r1   r2   r3   rr   r   r   s      r   test_async_historyr     s      }}ejj228J2KL mm%%+M%NO	' 
			 	 z7	 	C$*+++	T	 1	$$	$ ,s   B,C.C/$Cc                    K   | j                   j                  j                  t              }d}|j	                  d       d {   2 3 d {   }|dz  }7 7 6 |dkD  sJ y wr   r   r0   r1   r2   r^   r   s       r   test_async_stream_textr     sm     				 	 z	 	2$&334RSS  E
aKF T S 
!s6   AA$AA$AAAA$A	A$c                   K   | j                   j                  j                  t              }d}|j	                  t
        j                  j                  d             d {   2 3 d {   }|dz  }7 7 6 |dkD  sJ y wr   r   r0   r1   r2   r^   r	   r=   r>   r   s       r   test_async_stream_partr     s     				 	 z	 	2$&33jj >?   E aKF  
 
!s6   AB!A5"B&A9*A7+A9.B7A99	Bc                 H  K   | j                   j                  j                  t              }d}|j	                  t
        j                  j                  d      t
        j                  j                  d      g       d {   2 3 d {   }|dz  }7 7 6 |dkD  sJ y w)Nr,   r   r.   r:   r   r   r   r   s       r   test_async_stream_partsr     s     				 	 z	 	2$&33
**

$B

C
**

$>

?   E aKF   
!s6   A?B"BB"B
BBB"B	B"c                    K   ddi}| j                   j                  j                  t        |      }ddi}d}|j	                  d|       d {   2 3 d {   }||j
                  z  }7 7 6 d}|j	                  d       d {  7  2 3 d {  7  }||j
                  z  }6 t        j                  |      sJ t        j                  | t        j                        5  t        j                  |       d d d        y # 1 sw Y   y xY ww)	Nr   r   rN   r   r   r.   rq   z*tell me family friendly story in 100 words)r   r0   r1   r2   r^   r;   r   r   r   rf   r   r   s          r   !test_async_stream_config_overrider     s    %|4+				 	 z+	 	F$(*<=.33$^ 4   & &E 5::% &  334`aaa & &E5::% b 
'	((	(''0D0DE $JJ"#$ $ $ss   ADA,DA0A.A0D.A00DB
DB'BB'AD#D9	DDDc                 h  K   | j                   j                  j                  ddt        gi      }|j	                  d       d {   2 3 d {   }
7 7 6 |j	                  d       d {  7  2 3 d {  7  }6 |j                         }|d   j                  dk(  sJ |d   j                  d   j                  dk(  sJ |d   j                  d	k(  sJ |d   j                  d   j                  j                  d
k(  sJ |d   j                  d   j                  j                  dddk(  sJ y wr   )r   r0   r1   r   r^   r   r|   rT   r;   r   r   r   r   s       r   "test_async_stream_function_callingr     s]    				 	 "BCD 
! 
$
  334RSS 	 	E T 	S334QRRR 	 	E S!!#,	a			''	'	a		q	!	&	&*H	HH	H	a			((	(1oA,,11	566 
a		q	!	/	/	4	49 
  
s[   AD2AD2
AAAD2AD2-A0.D23A>7A:8A><B6D2c                    K   | j                   j                  j                  t              }|j	                  d       d {   2 3 d {   }
7 7 6 |j	                  d       d {  7  2 3 d {  7  }6 y wr   r   r   s      r   !test_async_stream_send_2_messagesr     s     				 	 z	 	2$33A  	 	E 	 	   33*   	 	E 	sY   ?A<AA<A
AAA<AA<)A,*A</A:3A64A:8A<c                     | j                   j                  ddt        j                  ddddddiid	
      gi      }|j	                  d      }|j	                  d      }y Nr   r   get_weatherzGet the weather in a city.objectlocationtypestring)r   
properties)r   descriptioninputSchemarN   zWhat is the weather in Boston?z%What is the weather in San Francisco?)r0   r1   	mcp_typesToolr3   r5   r6   r   s      r   test_mcp_toolsr    sv    			"nn$:&%/&(1C$D	 	 
 
$ ?@(FG(r   c                     | j                   j                  ddt        j                  ddddddiid	
      gi      }|j	                  d      D ]  } |j	                  d      D ]  } y r   )r0   r1   r  r  r^   r   s      r   test_mcp_tools_streamr	    s    			"
.. 6"!+fh-? @	
 
 
 
$ ''$ 	e 		 ''+ 	e 		r   c                   K   | j                   j                  j                  ddt        j                  ddddddiid	
      gi      }|j                  d       d {    |j                  d       d {    y 7 7 wr   )r   r0   r1   r  r  r3   r4   s     r   test_async_mcp_toolsr     s     				 	 $& < ('1FH3E&F!	 	 
! 
$ 	:;;;ABBB <Bs$   ABA=B7A?8B?Bc                 6  K   | j                   j                  j                  ddt        j                  ddddddiid	
      gi      }|j                  d       d {   2 3 d {   }
7 7 6 |j                  d       d {  7  2 3 d {  7  }6 y wr   )r   r0   r1   r  r  r^   r   s      r   test_async_mcp_tools_streamr  3  s     				 	 "
.. 6"!+fh-? @	
 
 
! 
$  33$  	 	E 	 	   33+   	 	E 	sZ   ABA-B#A1'A/(A1+B/A11BB	BBBBBc                     t        j                  | t              5  | j                  j	                  dddddddidd	d
gigi      }|j                  d      }|j                  d      }d d d        y # 1 sw Y   y xY wNr   r   mcp_serversweather_serverz-https://gemini-api-demos.uc.r.appspot.com/mcpAUTHORIZATIONzBearer github_pat_XXXX10s)urlheaderstimeout)r   streamable_http_transportrN   z,What is the weather in Boston on 02/02/2026?z3What is the weather in San Francisco on 02/02/2026?)r   rl   
ValueErrorr0   r1   r3   r  s      r   test_server_side_mcp_toolsr  N  s    ))&*= << !$4 %T %45M," ,1:$
  D.   !OPH  =H3  s   AA33A<c                    t        j                  | t              5  | j                  j	                  dddddddidd	d
gigi      }|j                  d      D ]  } |j                  d      D ]  } 	 d d d        y # 1 sw Y   y xY wr  )r   rl   r  r0   r1   r^   r   s      r   !test_server_side_mcp_tools_streamr  m  s    ((< << !$4 %T %45M," ,1:$
  D. ))6   ))=  9  s   AA>>Bc                 B  K   t        j                  | t              5  | j                  j                  j                  dddddddidd	d
gigi      }|j                  d       d {    |j                  d       d {    d d d        y 7 &7 # 1 sw Y   y xY wwr  )r   rl   r  r   r0   r1   r3   r4   s     r    test_async_server_side_mcp_toolsr    s     ((< ::"" !$4 %T %45M," ,1:$
 # D. 

J
KKK


=  3 0 L3 sA   BAB(B)BBB	BBBBB)Nr   ossyspydanticr   r   r   r   r   r   r	   mcpr  r
   McpClientSessionImportErroreversion_infosetup__file__globals
pytestmarkpytest_pluginsr2   intr   r   boolr!   strr&   floatr)   r7   r?   rB   rF   r\   r`   ri   rm   rx   r   r   r   r   markskipifr   r   r   asyncior   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  r   r   r   <module>r2     s     	 
  $    $3 !]  	Y
 %  
&&!$&&%# %# %D T 
&4 &t &# &# &5 T !H!H6% :/B;" 	#  11h 	#  11f0 / /B  0$$<	 : :
 U U
   6 6 % %        $ $&  4 		 		H$	2 D D$ 	 	4> F  e  	
	 
 G	s   K0 0L5LL