Format: application/x-python-code
1 o
2
3 ��ha$ � @ s\ d Z ddlmZmZ ddlmZmZmZ ddl Z ddl
4 mZmZ ddl
5 Z
6 ddlZddlmZ ddlZzddlZW n eyA Y nw ddlmZ ddlmZ d d
7 � Zdd� Zd
8 d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd � Z#d!d"� Z$d#d$� Z%G d%d&� d&e�Z&d'd(� Z'e'� G d)d*� d*e&��Z(ed2d,d-��Z)d.d/� Z*d0d1� Z+dS )3z Tests for IPython.lib.display.
9
10 � )�NamedTemporaryFile�mkdtemp)�split�join�dirnameN)�TestCase�mock)�BytesIO)�display)�skipif_not_numpyc C s t �d�} t �t�d��} dS )z(FileLink: Test class can be instantiated�example.txtN)r
11 �FileLink�pathlib�PurePath��fl� r �Tc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/lib/tests/test_display.py�test_instantiation_FileLink, s
12 r c C � t �d�} | �� �d�sJ �dS )zEFileLink: Calling _repr_html_ on non-existent files returns a warningr zPath (<tt>example.txt</tt>)N)r
13 r
14 �_repr_html_�
15 startswithr r r r �*test_warning_on_non_existent_path_FileLink2 �
16 r c C s: t � } t�| j�}|�� }d| j| jf }||ksJ �dS )zMFileLink: Calling _repr_html_ functions as expected on existing filepath
17 z'<a href='%s' target='_blank'>%s</a><br>N)r r
18 r
19 �namer ��tfr �actual�expectedr r r �test_existing_path_FileLink8 s
20 r c C s0 t � } t�| j�}t|�}| j}||ksJ �dS )zHFileLink: Calling repr() functions as expected on existing filepath
21 N)r r
22 r
23 r �reprr r r r � test_existing_path_FileLink_reprB s
24 r! c C s t � } t�ttj| � dS )z1FileLink: Raises error when passed directory
25 N)r �pytest�raises�
26 ValueErrorr
27 r
28 )�tdr r r �#test_error_on_directory_to_FileLinkL s r&