Hacked By AnonymousFox
�
�܋f� � �d � d Z ddlmZ ddlZddlZddgZ G d� d� � Z G d� de� � ZdS )z(Provide base classes for the test system� )�TestCaseN�TestBase�FileCreatorc �\ � e Zd ZdZdZdd�Zd� Zd� Zd� Ze d� � � Z
e d � � � Zd
S )r z�A instance which creates a temporary file with a prefix and a given size
and provides this info to the user.
Once it gets deleted, it will remove the temporary file as well.)�_size�_path� c �h � |s
J d� � �t j |�� � | _ || _ t | j d� � 5 }|� |dz
� � |� d� � d d d � � n# 1 swxY w Y t j � | j � � |k sJ �d S )NzRequire size to be larger 0)�prefix�wb� � 1)
�tempfile�mktempr r �open�seek�write�os�path�getsize)�self�sizer �fps �_/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/smmap/test/lib.py�__init__zFileCreator.__init__ s� � ��2�2�2�2�2�t��_�F�3�3�3��
���
�
�$�*�d�
#�
#� �r��G�G�D�1�H�����H�H�T�N�N�N� � � � � � � � � � � ���� � � � � �w���t�y�)�)�T�1�1�1�1�1�1s �.A=�=B�Bc �\ � t j | j � � d S # t $ r Y d S w xY w�N)r �remover �OSError�r s r �__del__zFileCreator.__del__ sA � � ��I�d�i� � � � � ��� � � ��D�D� ���s � �
+�+c � � | S r � r s r � __enter__zFileCreator.__enter__% s � ��� c �. � | � � � d S r )r! )r �exc_type� exc_value� tracebacks r �__exit__zFileCreator.__exit__( s � ��������r% c � � | j S r )r r s r r zFileCreator.path+ �
� ��z�r% c � � | j S r )r r s r r zFileCreator.size/ r, r% N)r )�__name__�
__module__�__qualname__�__doc__� __slots__r r! r$ r* �propertyr r r# r% r r r s� � � � � � �H� H� #�I�
2�
2�
2�
2�� � �� � �� � � �� � �X�� �� � �X�� � r% c �, � e Zd ZdZdZed� � � ZdS )r zFoundation used by all testsiK&z c � � d S r r# )�clss r �setUpAllzTestBase.setUpAll? s � �
�r% N)r. r/ r0 r1 �k_window_test_size�classmethodr7 r# r% r r r 6 s= � � � � � �&�&� 0�� �
�
� �[�
�
�
r% )r1 �unittestr r r �__all__r r r# r% r �<module>r<