File: //usr/lib/python3/dist-packages/twisted/python/test/__pycache__/test_constants.cpython-310.pyc
o
�b�� � @ s~ d Z ddlZddlmZ e�� � ejded� ddlmZm Z m
Z
mZmZm
Z
W d � n1 s2w 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 @ �@ 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 � 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 �D/usr/lib/python3/dist-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 �assertNotEqual�hashr"