U
    h
                     @  sZ   d Z ddlm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rVe  d	S )
zUnittest for html_utils.    )annotations)absltest)
html_utils)	sheets_idc                   @  s   e Zd Zdd Zdd ZdS )HtmlUtilsTestc                 C  s$   t jtddd}| d| d S )Nz"https://docs.google.com/?a=b#hellozhello<evil_tag/>worldurltextzk<a target="_blank" rel="noopener" href="https://docs.google.com/?a=b#hello">hello&lt;evil_tag/&gt;world</a>)r   get_anchor_tagr   	SheetsURLassertEqual)selfhtml r   P/tmp/pip-unpacked-wheel-doshhd5e/google/generativeai/notebook/html_utils_test.py#test_get_anchor_tag_text_is_escaped   s    z1HtmlUtilsTest.test_get_anchor_tag_text_is_escapedc                 C  s.   t d}d|_tj|dd}| d| d S )Nzhttps://docs.google.com/z%https://docs.google.com/"evil_string"zhello worldr   zh<a target="_blank" rel="noopener" href="https://docs.google.com/&quot;evil_string&quot;">hello world</a>)r   r   _urlr   r
   r   )r   r   r   r   r   r   "test_get_anchor_tag_url_is_escaped&   s    
z0HtmlUtilsTest.test_get_anchor_tag_url_is_escapedN)__name__
__module____qualname__r   r   r   r   r   r   r      s   r   __main__N)__doc__
__future__r   Zabsl.testingr   Zgoogle.generativeai.notebookr   r   ZTestCaser   r   mainr   r   r   r   <module>   s   !