shell bypass 403
o
`bg � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ e�de f��
e�
d�ZW d � n1 s5w Y G d d
� d
ej�Z
dd� Zed
krPe� dS dS )z�Test script for the binhex C module
Uses the mechanism of the python binhex module
Based on an original test by Roger E. Masse.
� N)�support)�
import_helper)� os_helper)�warnings_helper� �binhexc @ s8 e Zd Zdd� Zdd� ZdZdd� Zdd � Zd
d� ZdS )
�BinHexTestCasec C s( t jd | _t jd | _t jd | _d S )N�1�2ZPvery_long_filename__very_long_filename__very_long_filename__very_long_filename__)r ZTESTFN_ASCII�fname1�fname2�fname3��self� r �9/usr/local/python-3.10/lib/python3.10/test/test_binhex.py�setUp s zBinHexTestCase.setUpc C s( t �| j� t �| j� t �| j� d S �N)r �unlinkr r r
r r r r �tearDown s zBinHexTestCase.tearDowns Jack is my heroc C s� t | jd��}|�| j� W d � n1 sw Y t�| j| j� t�| j| j� t | jd��}|�� }W d � n1 sAw Y | �| j|� d S )N�wb�rb) �openr �write�DATAr r Zhexbin�readlineZassertEqual)r �fZfinishr r r �test_binhex s �
�zBinHexTestCase.test_binhexc C s0 t | jd�}|�� | �tjtj| j| j� dS )z�
The testcase fails if no exception is raised when a filename parameter provided to binhex.binhex()
is too long, or if the exception raised in binhex.binhex() is not an instance of binhex.Error.
r N)r r
�closeZassertRaisesr �Errorr )r Zf3r r r �"test_binhex_error_on_long_filename- s z1BinHexTestCase.test_binhex_error_on_long_filenamec C s� t | jd��}|�| j� W d � n1 sw Y t�| j| j� t | jd��}|�� }W d � n1 s9w Y | �d|� d S )Nr r �
)r r r r r r �readZassertNotIn)r r �fp�contentsr r r �test_binhex_line_endings7 s �
�z'BinHexTestCase.test_binhex_line_endingsN) �__name__�
__module__�__qualname__r r r r r r% r r r r r s
r c C s t �t� d S r )r Zrun_unittestr r r r r � test_mainC s r) �__main__)�__doc__Zunittest�testr Ztest.supportr r r Zcheck_warnings�DeprecationWarningZimport_fresh_moduler ZTestCaser r) r&