Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_secrets.cpython-311.pyc |
�
�Ke � �� � d Z ddlZddlZddlZ G d� dej � � Z G d� dej � � Z G d� dej � � Zed k r ej � � dS 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 �* � e Zd ZdZd� Zd� Zd� Zd� ZdS )�Compare_Digest_Testsz%Test secrets.compare_digest function.c � � dD ]�}|dz }|dz }| � t j ||� � � � | � t j |� d� � |� d� � � � � � ��d S )N)�a�bcd�xyz123�d �utf-8)�
assertTrue�secrets�compare_digest�encode��self�sr �bs �;/usr/local/apps/python3/lib/python3.11/test/test_secrets.py�
test_equalzCompare_Digest_Tests.test_equal s� � �'� Z� Z�A��#��A��#��A��O�O�G�2�1�a�8�8�9�9�9��O�O�G�2�1�8�8�G�3D�3D�a�h�h�w�FW�FW�X�X�Y�Y�Y�Y� Z� Z� c � � | � t j dd� � � � | � t j dd� � � � dD ]�}|dz dz }|dz dz }| � t j ||� � � � | � t j |� d � � |� d � � � � � � ��d S )
N�abc�abcds abcs abcd)�x�mn�a1b2c3r �q�kr
)�assertFalser r
r r s r �test_unequalz!Compare_Digest_Tests.test_unequal s� � �����/��v�>�>�?�?�?�����/���@�@�A�A�A�&� [� [�A��#����A��#����A����W�3�A�q�9�9�:�:�:����W�3�A�H�H�W�4E�4E�q�x�x�PW�GX�GX�Y�Y�Z�Z�Z�Z� [� [r c �, � d}|� d� � }t |t � � sJ �t |t � � sJ �| � t
t j ||� � | � t
t j ||� � d S )N�abcder
)r �
isinstance�str�bytes�assertRaises� TypeErrorr r
)r r r s r �test_bad_typesz#Compare_Digest_Tests.test_bad_types$ s� � ���
�H�H�W�����!�S�!�!�!�!�!��!�U�#�#�#�#�#����)�W�%;�Q��B�B�B����)�W�%;�Q��B�B�B�B�Br c � � | � t j dd� � t � � | � t j dd� � t � � d S )Nr �xyz)�assertIsInstancer r
�bool)r s r � test_boolzCompare_Digest_Tests.test_bool- sN � ����g�4�U�E�B�B�D�I�I�I����g�4�U�E�B�B�D�I�I�I�I�Ir N)�__name__�
__module__�__qualname__�__doc__r r r'