Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_pep247.cpython-34.pyc

�
f f��@s�dZddlZddlZddlmZmZmZmZmZm	Z	ddl
mZGdd�dej�Z
dd�Zed	kr�e�ndS)
zV
Test suite to check compilance with PEP 247, the standard API
for hashing algorithms
�N)�md5�sha1�sha224�sha256�sha384�sha512)�supportc@sReZdZddd�Zddd�Zdd�Zdd	�Zd
d�ZdS)�
Pep247TestNcCsX|jt|d��|j|jdkp7|jdk�|j|j|j|�dS)N�digest_sizer)�
assertTrue�hasattrr
�check_object�new)�self�module�key�r�5/opt/alt/python34/lib64/python3.4/test/test_pep247.py�check_module
s%zPep247Test.check_modulecCs�|dk	r�|dkr!t}n||d|�}||dd|�}||dd|�j�}||d|�}|jd�|j�}	nI|�}|d�}|d�j�}|�}|jd�|j�}	|j||	�|jt|d��|dk	r"|j|j|�n|j|jt|��|jd�|j�}
|j|j�|
j��|j|j	�|
j	��|j�|j	�}}d}
x|D]}|
d|7}
q�W|j|
|�dS)N�	digestmodsstringr
�z%02x)
r�digest�updateZassertEqualrrr
�len�copy�	hexdigest)r�clsr
rrZobj1Zobj2Zh1Zobj3Zh2Zobj_copyrrZhd2Zbyterrrr
s:	
		


zPep247Test.check_objectcCs|jtdd�dS)N)r
r)rrrr�test_md55szPep247Test.test_md5cCsc|jtdd�|jtdd�|jtdd�|jtdd�|jtdd�dS)N)r
rrrrr)rrrr�test_sha8s
zPep247Test.test_shacCs|jtdd�dS)Nrsabc)r�hmac)rrrr�	test_hmac?szPep247Test.test_hmac)�__name__�
__module__�__qualname__rr
rrr rrrrr	s
#r	cCstjt�dS)N)rZrun_unittestr	rrrr�	test_mainBsr$�__main__)�__doc__rZunittestZhashlibrrrrrrZtestrZTestCaser	r$r!rrrr�<module>s.7