ó
j4Vdc           @   sš   d  Z  d Z d d l Z d d l Z d d l m Z d e f d „  ƒ  YZ d d d d d d „ Z i  d	 „ Z	 e
 d
 k r– d „  Z e j d d ƒ n  d S(   sg   Self tests

These tests should perform quickly and can ideally be used every time an
application runs.
s   $Id$iÿÿÿÿN(   t   StringIOt   SelfTestErrorc           B   s   e  Z d  „  Z RS(   c         C   s)   t  j |  | | ƒ | |  _ | |  _ d  S(   N(   t	   Exceptiont   __init__t   messaget   result(   t   selfR   R   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyR   &   s    	(   t   __name__t
   __module__R   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyR   %   s   i    c   	      K   s  | d k r i  } n  t j ƒ  } |  d k r[ | d k rK t d | ƒ } n  | j | ƒ n4 | d k rƒ | j |  j d | ƒ ƒ n t d ƒ ‚ | d k r« t ƒ  | d <n  t j d | |  } | j | ƒ } | j	 ƒ  s| d k r t
 j j | j ƒ  ƒ n  t d | ƒ ‚ n  | S(   s6  Execute self-tests.

    This raises SelfTestError if any test is unsuccessful.

    You may optionally pass in a sub-module of SelfTest if you only want to
    perform some of the tests.  For example, the following would test only the
    hash modules:

        Crypto.SelfTest.run(Crypto.SelfTest.Hash)

    t   configs5   'module' and 'tests' arguments are mutually exclusivet   streamt	   verbositys   Self-test failedN(   t   Nonet   unittestt	   TestSuitet	   get_testst   addTestst
   ValueErrorR    t   TextTestRunnert   runt   wasSuccessfult   syst   stderrt   writet   getvalueR   (	   t   moduleR   R
   t   testsR	   t   kwargst   suitet   runnerR   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyR   +   s&    	c   	      C   s  g  } d d l  m } | | j d |  ƒ 7} d d l  m } | | j d |  ƒ 7} d d l  m } | | j d |  ƒ 7} d d l  m } | | j d |  ƒ 7} d d l  m } | | j d |  ƒ 7} d d l  m } | | j d |  ƒ 7} d d	 l  m } | | j d |  ƒ 7} | S(
   Niÿÿÿÿ(   t   CipherR	   (   t   Hash(   t   Protocol(   t	   PublicKey(   t   Random(   t   Util(   t	   Signature(	   t   Crypto.SelfTestR   R   R   R    R!   R"   R#   R$   (	   R	   R   R   R   R    R!   R"   R#   R$   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyR   M   s            t   __main__c           C   s   t  j t ƒ  ƒ S(   N(   R   R   R   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyt   <lambda>Y   t    t   defaultTestR   (   t   __doc__t   __revision__R   R   R    R   R   R   R   R   R   R   t   main(    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/Crypto/SelfTest/__init__.pyt   <module>   s   "	