관리-도구
편집 파일: ddt.cpython-311.pyc
� �܋f�1 � �x � d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z d dl Z dZn # e$ r dZY nw xY wdZ dZdZd Zd ZdZ ed� � eeeefZn# e$ r ed� � eeeefZY nw xY we G d� d e� � � � Zd� Zd� Zd� Zdd�Zdd�Z d dej! fd�Z"d� Z#d� Z$d� Z%d� Z&d� Z'd� Z(dd�Z)dS )� N)�Enum�unique)�wrapsTFz1.4.4z%valuesz %file_pathz%yaml_loaderz%unpackz %index_lenc � � e Zd ZdZdZdZdS )�TestNameFormata� An enum to configure how ``mk_test_name()`` to compose a test name. Given the following example: .. code-block:: python @data("a", "b") def testSomething(self, value): ... if using just ``@ddt`` or together with ``DEFAULT``: * ``testSomething_1_a`` * ``testSomething_2_b`` if using ``INDEX_ONLY``: * ``testSomething_1`` * ``testSomething_2`` r � N)�__name__� __module__�__qualname__�__doc__�DEFAULT� INDEX_ONLY� � �T/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/ddt.pyr r * s$ � � � � � �� �* �G��J�J�Jr r c � � t | t � � rdS t | t t f� � r"t t t | � � � � S dS )NTF)� isinstance� trivial_types�list�tuple�all�map� is_trivial)�values r r r E sL � ��%��'�'� +��t� �E�D�%�=� )� )� +��3�z�5�)�)�*�*�*��5r c �2 � t | t d� � | S )z2 Method decorator to add unpack feature. T)�setattr�UNPACK_ATTR)�funcs r �unpackr M s � � �D�+�t�$�$�$��Kr c � � t | � � S )z Method decorator to add to your test methods. Should be added to methods of instances of ``unittest.TestCase``. )�idata)�valuess r �datar# V s � � ��=�=�r c � � �� ��8t � � � � t t t � � � � � � � ��� fd�}|S )a� Method decorator to add to your test methods. Should be added to methods of instances of ``unittest.TestCase``. :param iterable: iterable of the values to provide to the test function. :param index_len: an optional integer specifying the width to zero-pad the test identifier indices to. If not provided, this will add the fewest zeros necessary to make all identifiers the same length. Nc �` �� t | t �� � t | t �� � | S �N)r � DATA_ATTR� INDEX_LEN)r � index_len�iterables ��r �wrapperzidata.<locals>.wrapperp s, �� ���i��*�*�*���i��+�+�+��r )r �len�str)r* r) r+ s `` r r! r! ` sW ��� � ����?�?����C��M�M�*�*�+�+� �� � � � � � �Nr c � � �� � �fd�}|S )a� Method decorator to add to your test methods. Should be added to methods of instances of ``unittest.TestCase``. ``value`` should be a path relative to the directory of the file containing the decorated ``unittest.TestCase``. The file should contain JSON encoded data, that can either be a list or a dict. In case of a list, each value in the list will correspond to one test case, and the value will be concatenated to the test method name. In case of a dict, keys will be used as suffixes to the name of the test case, and values will be fed as test data. ``yaml_loader`` can be used to customize yaml deserialization. The default is ``None``, which results in using the ``yaml.safe_load`` method. c �d �� t | t �� � �rt | t �� � | S r&