Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/python/test/__pycache__/test_constants.cpython-39.pyc
Ðазад
a k�h�� � @ s~ d Z ddlZddlmZ e�� �> ejded� ddlmZm Z m Z mZmZm Z W d � n1 sd0 Y G dd� de�ZG d d � d �ZG dd� dee�ZG d d� dee�ZG dd� d�ZG dd� deee�ZG dd� dee�ZG dd� dee�ZG dd� dee�ZG dd� dee�ZG dd� de�ZG dd� de�ZG dd � d e�ZG d!d"� d"e �ZG d#d$� d$e �ZG d%d&� d&e�ZdS )'z- Unit tests for L{twisted.python.constants}. � N)�TestCase�ignore)�category)�FlagConstant�Flags� NamedConstant�Names� ValueConstant�Valuesc @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )�NamedConstantTestszy Tests for the L{twisted.python.constants.NamedConstant} class which is used to represent individual values. c C s G dd� dt �}|| _dS )zN Create a dummy container into which constants can be placed. c @ s e Zd ZdS )z%NamedConstantTests.setUp.<locals>.fooN)�__name__� __module__�__qualname__� r r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/python/test/test_constants.py�foo$ s r N)r � container)�selfr r r r �setUp s zNamedConstantTests.setUpc C s( t � }|�| jdd� | �d|j� dS )z� The C{name} attribute of a L{NamedConstant} refers to the value passed for the C{name} parameter to C{_realize}. �barN)r �_realizer �assertEqual�name�r r r r r � test_name) s zNamedConstantTests.test_namec C s* t � }|�| jdd� | �dt|�� dS )z� The string representation of an instance of L{NamedConstant} includes the container the instances belongs to as well as the instance's name. r Nz <foo=bar>)r r r r �reprr r r r �test_representation2 s z&NamedConstantTests.test_representationc C s6 t � }|�| jdd� | �||k� | �||k� dS )zG A L{NamedConstant} instance compares equal to itself. r N)r r r � assertTrue�assertFalser r r r � test_equality; s z NamedConstantTests.test_equalityc C sL t � }|�| jdd� t � }|�| jdd� | �||k� | �||k� dS )zf Two different L{NamedConstant} instances do not compare equal to each other. r N)r r r r r �r �first�secondr r r �test_nonequalityD s z#NamedConstantTests.test_nonequalityc C sD t � }|�| jdd� t � }|�| jdd� | �t|�t|�� dS )z� Because two different L{NamedConstant} instances do not compare as equal to each other, they also have different hashes to avoid collisions when added to a C{dict} or C{set}. r N)r r r ZassertNotEqual�hashr r r r � test_hashP s zNamedConstantTests.test_hashN) r r r �__doc__r r r r r# r% r r r r r s r c @ s e Zd ZdZdd� Zdd� ZdS )�_ConstantsTestsMixinz\ Mixin defining test helpers common to multiple types of constants collections. c C s$ | � t|�}| �|d t|�� dS )z� Assert that an attempt to instantiate the constants class raises C{TypeError}. @param name: A C{str} giving the name of the constants collection. @param cls: The constants class to test. z may not be instantiated.N)�assertRaises� TypeErrorr �str)r r �cls�excr r r �_notInstantiableTestc s z)_ConstantsTestsMixin._notInstantiableTestc C s&