File: //usr/lib/python3/dist-packages/twisted/python/test/__pycache__/test_constants.cpython-38.pyc
U
W[� � @ s~ d Z ddlmZmZ ddlZddlmZ e�� �4 ejde d� ddl
mZmZm
Z
mZmZmZ W 5 Q R X G dd � d e�ZG d
d� de�ZG dd
� d
ee�ZG dd� dee�ZG dd� de�ZG dd� deee�ZG dd� dee�ZG dd� dee�ZG dd� dee�ZG dd� dee�ZG dd� de�ZG dd� de�ZG d d!� d!e�ZG d"d#� d#e�ZG d$d%� d%e�Z G d&d'� d'e�Z!dS )(z-
Unit tests for L{twisted.python.constants}.
� )�division�absolute_importN)�TestCase�ignore)�category)�
NamedConstant�Names�
ValueConstant�Values�FlagConstant�Flagsc @ 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 �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_representation. 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_equality8 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_nonequalityB 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"