3
r«Y]Ú  ã               @   sL   d Z ddlZddlZddlmZ G dd„ dejƒZdd„ ZedkrHeƒ  dS )	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)Úsupportc               @   s0   e Zd Zdd„ Zdd„ ZdZdd„ Zdd	„ Zd
S )ÚBinHexTestCasec             C   s(   t jd | _t jd | _t jd | _d S )NÚ1Ú2ZPvery_long_filename__very_long_filename__very_long_filename__very_long_filename__)r   ZTESTFNÚfname1Úfname2Úfname3)Úself© r
   ú!lib/python3.6/test/test_binhex.pyÚsetUp   s    zBinHexTestCase.setUpc             C   s(   t j| jƒ t j| jƒ t j| jƒ d S )N)r   Úunlinkr   r   r   )r	   r
   r
   r   ÚtearDown   s    zBinHexTestCase.tearDowns   Jack is my heroc             C   sn   t | jdƒ}|j| jƒ |jƒ  tj| j| jƒ tj| j| jƒ t | jdƒ}|jƒ }|jƒ  | j	| j|ƒ d S )NÚwbÚrb)
Úopenr   ÚwriteÚDATAÚcloseÚbinhexr   ZhexbinÚreadlineZassertEqual)r	   ÚfZfinishr
   r
   r   Útest_binhex   s    zBinHexTestCase.test_binhexc             C   s0   t | jdƒ}|jƒ  | jtjtj| j| jƒ dS )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   r   ZassertRaisesr   ÚErrorr   )r	   Zf3r
   r
   r   Ú"test_binhex_error_on_long_filename(   s    z1BinHexTestCase.test_binhex_error_on_long_filenameN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r
   r
   r
   r   r      s
   r   c               C   s   t jtƒ d S )N)r   Zrun_unittestr   r
   r
   r
   r   Ú	test_main2   s    r   Ú__main__)	Ú__doc__r   ZunittestZtestr   ZTestCaser   r   r   r
   r
   r
   r   Ú<module>   s   '