
    ¿ig                         d Z ddlZddlZddlmZ ddlmZ  G d de          ZddZ	i fdZ
ed	k    rd
 Z ej        d           dS dS )zgSelf tests

These tests should perform quickly and can ideally be used every time an
application runs.
    N)import_module)StringIOc                       e Zd Zd ZdS )SelfTestErrorc                 Z    t                               | ||           || _        || _        d S N)	Exception__init__messageresult)selfr   r   s      X/var/www/html/afkarena/venv/lib/python3.11/site-packages/Cryptodome/SelfTest/__init__.pyr
   zSelfTestError.__init__&   s,    4&111    N)__name__
__module____qualname__r
    r   r   r   r   %   s#            r   r   c                 :   |i }t          j                    }| (|t          |          }|                    |           n;|*|                    |                     |                     nt	          d          |t                      |d<   n||d<   t          j        dd|i|}|                    |          }|                                sI|7t          j
                            |d                                                    t          d|          |S )a>  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:

        Cryptodome.SelfTest.run(Cryptodome.SelfTest.Hash)

    Nconfigz5'module' and 'tests' arguments are mutually exclusivestream	verbosityzSelf-test failedr   )unittest	TestSuite	get_testsaddTests
ValueErrorr   TextTestRunnerrunwasSuccessfulsysstderrwritegetvaluer   )	moduler   r   testsr   kwargssuiterunnerr   s	            r   r   r   ,   s'    ~  E~=V,,,Eu=NN6++6+::;;;;TUUU~#::x!x$CCyCFCCFZZF!! 8>JVH-6688999.777Mr   c                 r    g }g d}|D ]-}t          d|z             }||                    |           z  }.|S )N)	CipherHashProtocol	PublicKeyRandomUtil	SignatureIOMathzCryptodome.SelfTest.r   )r   r   )r   r&   module_namesnamer%   s        r   r   r   R   s^    E
 
 
L
  1 15<==!!!000Lr   __main__c                  B    t          j        t                                S r   )r   r   r   r   r   r   r(   r(   b   s    !)++...r   r(   )defaultTest)Nr   NNN)__doc__r!   r   	importlibr   Cryptodome.Util.py3compatr   r	   r   r   r   r   r(   mainr   r   r   <module>r=      s   2  


  # # # # # # . . . . . .    I   # # # #L      z/ / /HMg&&&&&& r   