U
    h+                     @  sN   d Z ddlmZ ddlmZ ddlmZ G dd dejZe	dkrJe
  dS )	zUnittest for py_utils.    )annotations)absltest)	sheets_idc                   @  s   e Zd Zdd Zdd ZdS )SheetsIdentifierTestc                 C  sd   t jdd}| dt| t jt dd}| dt| t jt dd}| dt| d S )	Nhellonamez
name=hello)keyz	key=hellohttps://docs.google.com/)urlzurl=https://docs.google.com/)r   SheetsIdentifierassertEqualstr	SheetsKey	SheetsURL)selfZsid r   O/tmp/pip-unpacked-wheel-doshhd5e/google/generativeai/notebook/sheets_id_test.pytest_constructor   s    z%SheetsIdentifierTest.test_constructorc              	   C  s   |  td t  W 5 Q R X |  td tjdd W 5 Q R X |  td tjdtdd W 5 Q R X |  td" tjdtdtdd W 5 Q R X d S )Nz(Must set exactly one of name, key or url r   r   )r   r	   r
   )r   r	   r   )assertRaisesRegex
ValueErrorr   r   r   r   )r   r   r   r   test_constructor_error"   s0        z+SheetsIdentifierTest.test_constructor_errorN)__name__
__module____qualname__r   r   r   r   r   r   r      s   
r   __main__N)__doc__
__future__r   Zabsl.testingr   Zgoogle.generativeai.notebookr   ZTestCaser   r   mainr   r   r   r   <module>   s   '