관리-도구
편집 파일: fake_tempfile_test.cpython-311.pyc
� �܋fV � � � d Z ddlZddlZddlZddlZddlmZ G d� dej � � Ze dk r ej � � dS dS )zTests that ensure that the `tempfile` module works with `fake_filesystem` if using `Patcher` (via `fake_filesystem_unittest`). � N)�fake_filesystem_unittestc �H � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � ZdS )�FakeTempfileModuleTestz5Test the 'tempfile' module with the fake file system.c �. � | � � � d S �N)� setUpPyfakefs)�selfs �r/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyfakefs/tests/fake_tempfile_test.py�setUpzFakeTempfileModuleTest.setUp s � ��������� c �\ � t j � � }| � | j � |j � � � � |� � � | � t � � 5 | j � |j � � d d d � � d S # 1 swxY w Y d S r ) �tempfile�NamedTemporaryFile� assertTrue�fs� get_object�name�close�assertRaises�OSError)r �objs r �test_named_temporary_filez0FakeTempfileModuleTest.test_named_temporary_file! s� � ��)�+�+�������*�*�3�8�4�4�5�5�5�� � ���� � � �w� '� '� )� )��G���s�x�(�(�(� )� )� )� )� )� )� )� )� )� )� )� )���� )� )� )� )� )� )s �4 B!�!B%�(B%c �� � t j d�� � }|� d� � |� � � | j � |j � � }|j }| � d|� � t j dd�� � }|� d� � |� � � | j � |j � � }| � d|j � � d S )NF)�deletes foo�foo�w)�moder ) r r �writer r r r �contents�assertEqual)r r �file_objr s r �#test_named_temporary_file_no_deletez:FakeTempfileModuleTest.test_named_temporary_file_no_delete( s� � ��)��7�7�7��� � �&����� � �����7�%�%�c�h�/�/���$�������)�)�)��)�s�5�A�A�A��� � �%����� � �����7�%�%�c�h�/�/������� 1�2�2�2�2�2r c �: � t | j j � � }t j � � }| � dt |� � � � | � |d � t j � t j � � d� � � � � � | � ||d � � | � | j � |d � � � � | j j rdnd}| � | j � |d � � j t j |z � � t j |d d� � }| � |d |� � � � � d S )N� � �tmpr � � zw+b)�lenr � open_filesr �mkstempr r � startswith�os�path�join� gettempdir�exists� is_windows_fsr �st_mode�stat�S_IFREG�fdopen�fileno)r �next_fd� temporaryr �fhs r �test_mkstempz#FakeTempfileModuleTest.test_mkstemp5 sG � ��d�g�(�)�)���$�&�&� �����C� �N�N�+�+�+�����a�L�#�#�B�G�L�L��1D�1F�1F��$N�$N�O�O� � � � ����)�A�,�/�/�/��������y��|�4�4�5�5�5���-�8�u�u�5�������+�+�I�a�L�9�9�A�4�<�RV�CV�W�W�W� �Y�y��|�U� +� +������1��r�y�y�{�{�3�3�3�3�3r c �b � | � t � � 5 t j d�� � ddd� � n# 1 swxY w Y | j � d� � t | j j � � }t j d�� � }| � dt |� � � � | � ||d � � | � |d � t j � | j j dd� � � � � � | � | j � |d � � � � | j j rd nd }| � | j � |d � � j t&