| Server IP : 118.27.122.248 / Your IP : 216.73.216.15 Web Server : Apache System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64 User : c9415830 ( 11735) PHP Version : 8.4.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python36/lib64/python3.6/test/__pycache__/ |
Upload File : |
3
�w2_ � @ sf d Z ddlZddlZddlZG dd� dej�ZG dd� dej�ZG dd� dej�Zed krbej � dS )
z�Test the secrets module.
As most of the functions in secrets are thin wrappers around functions
defined elsewhere, we don't need to test them exhaustively.
� Nc @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�Compare_Digest_Testsz%Test secrets.compare_digest function.c C sR xLdD ]D}|d }|d }| j tj||�� | j tj|jd�|jd��� qW d S )N�a�bcd�xyz123�d zutf-8)r r r )�
assertTrue�secrets�compare_digest�encode)�self�sr �b� r �6/opt/alt/python36/lib64/python3.6/test/test_secrets.py�
test_equal s
zCompare_Digest_Tests.test_equalc C s~ | j tjdd�� | j tjdd�� xTdD ]L}|d d }|d d
}| j tj||�� | j tj|jd�|jd��� q*W d S )
N�abcZabcds abcs abcd�x�mn�a1b2c3r �q�kzutf-8)r r r )ZassertFalser r r
)r r r r
r r r �test_unequal s
z!Compare_Digest_Tests.test_unequalc C sR d}|j d�}t|t�st�t|t�s*t�| jttj||� | jttj||� d S )NZabcdezutf-8) r
�
isinstance�str�AssertionError�bytes�assertRaises� TypeErrorr r )r r r
r r r �test_bad_types$ s
z#Compare_Digest_Tests.test_bad_typesc C s, | j tjdd�t� | j tjdd�t� d S )Nr Zxyz)�assertIsInstancer r �bool)r r r r � test_bool- s zCompare_Digest_Tests.test_boolN)�__name__�
__module__�__qualname__�__doc__r r r r! r r r r r s
r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �Random_Testsz*Test wrappers around SystemRandom methods.c C s^ d}xTdD ]L}xFt d�D ]:}tj|�}| jd| ko@d| k n |||f � qW q
W d S ) Nzrandbits(%d) returned %d� � � � r � )r'