Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_pep247.cpython-35.pyc



��Yfv�@sdZddlZddlZddlmZmZmZmZmZm	Z	Gdd�dej
�Zedkr{ej
�dS)zV
Test suite to check compliance with PEP 247, the standard API
for hashing algorithms
�N)�md5�sha1�sha224�sha256�sha384�sha512c@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/python35/lib64/python3.5/test/test_pep247.py�check_modules%zPep247Test.check_modulecCs�|dk	r�|dkrt}||d|�}||dd|�}||dd|�j�}||d|�}|jd�|j�}	nI|�}|d�}|d�j�}|�}|jd�|j�}	|j||	�|jt|d��|dk	r|j|j|�|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�updateZassertEqualr
rr	�len�copy�	hexdigest)r�clsr	rrZobj1Zobj2Zh1Zobj3Zh2Zobj_copyrrZhd2Zbyterrrrs:
		


zPep247Test.check_objectcCs|jtdd�dS)N)rr)rrrr�test_md54szPep247Test.test_md5cCsc|jtdd�|jtdd�|jtdd�|jtdd�|jtdd�dS)N)rrrrrr)rrrr�test_sha7s
zPep247Test.test_shacCs|jtdd�dS)Nrsabc)r�hmac)rrrr�	test_hmac>szPep247Test.test_hmac)�__name__�
__module__�__qualname__rrrrrrrrrr
s
#r�__main__)�__doc__rZunittestZhashlibrrrrrrZTestCaserr �mainrrrr�<module>s.7