o
    5h                     @   sv   d Z ddlZddlZddlmZ ddlmZ G dd deZdddZ	i fd	d
Z
edkr9dd Zejd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                   @   s   e Zd Zdd ZdS )SelfTestErrorc                 C   s   t | || || _|| _d S N)	Exception__init__messageresult)selfr   r	    r   l/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/Crypto/SelfTest/__init__.pyr   &   s   
zSelfTestError.__init__N)__name__
__module____qualname__r   r   r   r   r   r   %   s    r   c           	      K   s   |du ri }t  }| du r|du rt|d}|| n|du r+|| j|d ntd|du r9t |d< n||d< t jdd|i|}||}| sc|du r^t	j
|d   td||S )a6  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)

    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	   r   r   r   r   ,   s(   


r   c                 C   s6   g }g d}|D ]}t d| }||j| d7 }q|S )N)	CipherHashProtocol	PublicKeyRandomUtil	SignatureIOMathzCrypto.SelfTest.r   )r   r   )r   r!   module_namesnamer    r   r   r   r   R   s   r   __main__c                   C   s   t t S r   )r   r   r   r   r   r   r   r#   b   s   r#   )defaultTest)Nr   NNN)__doc__r   r   	importlibr   Crypto.Util.py3compatr   r   r   r   r   r   r#   mainr   r   r   r   <module>   s   
&