ó
­«Y]c           @   s´   d  Z  d d l Z e j d d e ƒ e j d d e ƒ d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 d e j
 f d „  ƒ  YZ d	 „  Z e d
 k r° e ƒ  n  d S(   sV   
Test suite to check compliance with PEP 247, the standard API
for hashing algorithms
iÿÿÿÿNt   ignores   the md5 module is deprecated.*s   the sha module is deprecated.*(   t   test_supportt
   Pep247Testc           B   s/   e  Z d d  „ Z d „  Z d „  Z d „  Z RS(   c         C   s  |  j  t | d ƒ ƒ |  j  | j d  k p7 | j d k ƒ | d  k	 r« | j | ƒ } | j | d ƒ } | j | d ƒ j ƒ  } | j | ƒ } | j d ƒ | j ƒ  } nU | j ƒ  } | j d ƒ } | j d ƒ j ƒ  } | j ƒ  } | j d ƒ | j ƒ  } |  j | | ƒ |  j  t | d ƒ ƒ | j d  k	 rN|  j | j | j ƒ n  |  j | j t | ƒ ƒ | j d ƒ | j	 ƒ  } |  j | j ƒ  | j ƒ  ƒ |  j | j
 ƒ  | j
 ƒ  ƒ | j ƒ  | j
 ƒ  }	 }
 d } x" |	 D] } | d t | ƒ 7} qÞW|  j | |
 ƒ d  S(   Nt   digest_sizei    t   stringt    s   %02x(   t
   assertTruet   hasattrR   t   Nonet   newt   digestt   updatet   assertEqualt   lent   copyt	   hexdigestt   ord(   t   selft   modulet   keyt   obj1t   obj2t   h1t   obj3t   h2t   obj_copyR
   R   t   hd2t   byte(    (    s!   lib/python2.7/test/test_pep247.pyt   check_module   s:    %c         C   s   |  j  t ƒ d  S(   N(   R   t   md5(   R   (    (    s!   lib/python2.7/test/test_pep247.pyt   test_md5=   s    c         C   s   |  j  t ƒ d  S(   N(   R   t   sha(   R   (    (    s!   lib/python2.7/test/test_pep247.pyt   test_sha@   s    c         C   s   |  j  t d d ƒd  S(   NR   t   abc(   R   t   hmac(   R   (    (    s!   lib/python2.7/test/test_pep247.pyt	   test_hmacC   s    N(   t   __name__t
   __module__R   R   R   R    R#   (    (    (    s!   lib/python2.7/test/test_pep247.pyR      s   (		c           C   s   t  j t ƒ d  S(   N(   R   t   run_unittestR   (    (    (    s!   lib/python2.7/test/test_pep247.pyt	   test_mainF   s    t   __main__(   t   __doc__t   warningst   filterwarningst   DeprecationWarningR"   R   R   t   unittestt   testR   t   TestCaseR   R'   R$   (    (    (    s!   lib/python2.7/test/test_pep247.pyt   <module>   s   3	