관리-도구
편집 파일: test_util.cpython-311.pyc
� �܋f� � �Z � d Z ddlZddlZddlmZ ddlmZmZmZm Z G d� de� � Z dS )zTest for object db� N)�TestBase)� to_hex_sha� to_bin_sha�NULL_HEX_SHA�LockedFDc � � e Zd Zd� Zd� Zd� ZdS )� TestUtilsc � � t t � � t k sJ �t t t � � � � dk sJ �t t t � � � � t j d� � k sJ �d S )N� �ascii)r r �lenr �encode)�selfs �e/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/gitdb/test/test_util.py�test_basicszTestUtils.test_basics sn � ��,�'�'�<�7�7�7�7��:�l�+�+�,�,��2�2�2�2��*�\�2�2�3�3�|�7J�7�7S�7S�S�S�S�S�S�S� c � � t |d� � 5 }|� � � |� d� � k sJ � d d d � � d S # 1 swxY w Y d S )N�rbr )�open�readr )r � file_path�data�fps r � _cmp_contentszTestUtils._cmp_contents s� � � �)�T� "� "� 5�b��7�7�9�9����G� 4� 4�4�4�4�4�4� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5���� 5� 5� 5� 5� 5� 5s �.A � A�Ac � � t j � � }d}d}t |d� � 5 }|� |� d� � � � d d d � � n# 1 swxY w Y t |� � }|� � � }| � t |j � � | � t |j � � t j � |� � rJ �|� d�� � }|j |u sJ �t j � |� � sJ �t j ||� d� � � � |� � � |j �J �| � ||� � t j � |� � rJ �|� � � |� � � t |� � }|� d�� � }t j |t# |� � � � |� d� � k sJ �t j � |� � sJ �~t j � |� � rJ �t |� � }t |� � } t j � |� � rJ �|� dd�� � } t j � |� � sJ �| � t$ | j � � | � |� d� � � � |� � � t j � |� � rJ �| � ||� � t j |� � n# t j |� � w xY wt t j � � � � } |� d�� � | � d � � d S # t* $ r7 t j � |� � � � � rJ �Y d S w xY w) N�hello�world�wbr T)�writeF)r �streamzexpected OSError)�tempfile�mktempr r r r � _lockfilepath�assertRaises�AssertionError�rollback�commit�os�path�isfile�_fdr r r �IOError�remove�fail�OSError�exists)r �my_file� orig_data�new_data� my_file_fp�lfd�lockfilepath�wfd�rfd�olfd� wfdstreams r � test_lockedfdzTestUtils.test_lockedfd s� � ��/�#�#��� ��� �'�4� � � 8�J����Y�-�-�g�6�6�7�7�7� 8� 8� 8� 8� 8� 8� 8� 8� 8� 8� 8���� 8� 8� 8� 8�3 ��7�#�#�C��,�,�.�.�L� ���n�c�l�;�;�;����n�c�j�9�9�9� �w�~�~�l�3�3�3�3�3��(�(��(�&�&�C��7�c�>�>�>�>��7�>�>�,�/�/�/�/�/� �H�S�(�/�/�'�2�2�3�3�3��L�L�N�N�N��7�?�?�?����w� �2�2�2��w�~�~�l�3�3�3�3�3� �J�J�L�L�L��L�L�N�N�N� �7�#�#�C��(�(��(�'�'�C��7�3��I���/�/�9�3C�3C�G�3L�3L�L�L�L�L��7�>�>�,�/�/�/�/�/���w�~�~�l�3�3�3�3�3� �7�#�#�C��G�$�$�D��w�~�~�l�3�3�3�3�3����t�D��9�9�I��7�>�>�,�/�/�/�/�/����g�t�y�1�1�1��O�O�H�O�O�G�4�4�5�5�5��J�J�L�L�L��w�~�~�l�3�3�3�3�3����w��1�1�1� �I�g������B�I�g�������� �x��(�(�)�)�� *��H�H�5�H�!�!�!� �I�I�(�)�)�)�)�)�� � ;� ;� ;��w�~�~�c�&7�&7�&9�&9�:�:�:�:�:�:�:�:� ;���s0 �)A�A!�$A!�)LN �N+�O<