o
    iK                     @   s8  U d dl Z ddlmZ ddlmZ ddlmZ ddlmZ ejd	ed
gdZ	ejd	ed
gdej
idZejd	ed
gdejidZdZejddejd	ed
gddejdeddejdedddejddejd	eegddgZeej ed< ejee dedZdd Ze jjdd Zdd  ZdS )!    N   )_transformers)types   )pytest_helper   )	constantsgemini-2.5-flashzTell me a story in 300 words.modelcontentshttp_options)r   r   configu#   这是一条unicode测试🤪❤★test_compute_tokenszonly supported in)nameexception_if_mldev
parameters%test_compute_tokens_vertex_custom_url)r   r   r   $test_compute_tokens_mldev_custom_url404)r   r   exception_if_vertexr   test_compute_tokens_unicode
test_tablezmodels.compute_tokens)fileglobals_for_filetest_methodr   c                 C   sR   | j jr%| jjtjtd}d|jd j	}|dksJ |
dtks'J d S d S )Nr
       r   s#   这是一条unicode测试🤪❤★zutf-8)_api_clientvertexaimodelscompute_tokens_COMPUTE_TOKENS_PARAMSr   _UNICODE_STRINGjointokens_infotokensdecode)clientresponsedecoded_tokens r*   a/home/ubuntu/.local/lib/python3.10/site-packages/google/genai/tests/models/test_compute_tokens.py test_token_bytes_deserializationK   s   
r,   c                    s~   | j jr| jjjtjtjdI d H }|sJ d S t	t
 | jjjtjtjdI d H  W d    d S 1 s8w   Y  d S )Nr
   )r   r   aior   r    r!   r   r   pytestraises	Exception)r'   r(   r*   r*   r+   
test_asyncY   s   "r1   c                 C   s^   | j jr+| jjdtjd}|sJ | jjdtjd}|sJ | jjdtjd}|s-J d S d S )Nr	   r
   z)publishers/google/models/gemini-2.5-flashzRprojects/vertexsdk/locations/us-central1/publishers/google/models/gemini-2.5-flash)r   r   r   r    r!   r   )r'   	response1	response3	response4r*   r*   r+   test_different_model_namesi   s"   r5   )r.    r   tr   r   r   _ComputeTokensParameters	t_contentr!   VERTEX_HTTP_OPTIONS(_COMPUTE_TOKENS_PARAMS_VERTEX_CUSTOM_URLMLDEV_HTTP_OPTIONS'_COMPUTE_TOKENS_PARAMS_MLDEV_CUSTOM_URLr"   TestTableItemr   list__annotations__setup__file__globals
pytestmarkr,   markasyncior1   r5   r*   r*   r*   r+   <module>   sr   





