o
    YiK                     @   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contentsZhttp_options)r   r   configu#   这是一条unicode测试🤪❤★Ztest_compute_tokenszonly supported in)nameexception_if_mldev
parametersZ%test_compute_tokens_vertex_custom_url)r   r   r   Z$test_compute_tokens_mldev_custom_urlZ404)r   r   Zexception_if_vertexr   Ztest_compute_tokens_unicode
test_tablezmodels.compute_tokens)fileZglobals_for_fileZ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joinZtokens_infotokensdecode)clientresponseZdecoded_tokens r   g/home/kim/smarthome/.venv/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   Zaior   r   r   r   r   pytestZraises	Exception)r   r   r   r   r    
test_asyncY   s   "r$   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   Z	response1Z	response3Z	response4r   r   r    test_different_model_namesi   s"   r%   )r"    r   tr   r   r   Z_ComputeTokensParametersZ	t_contentr   ZVERTEX_HTTP_OPTIONSZ(_COMPUTE_TOKENS_PARAMS_VERTEX_CUSTOM_URLZMLDEV_HTTP_OPTIONSZ'_COMPUTE_TOKENS_PARAMS_MLDEV_CUSTOM_URLr   ZTestTableItemr   list__annotations__setup__file__globalsZ
pytestmarkr!   markZasyncior$   r%   r   r   r   r    <module>   sr   





