File: //usr/lib/python3/dist-packages/twisted/test/__pycache__/test_reflect.cpython-310.pyc
o
�b�_ � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZm Z m
Z
mZmZ ddl
mZ G dd� d�ZG d d
� d
e�ZG dd� d�ZG d
d� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� d�ZG dd� de�ZG dd� d�ZG dd� dee�Zedefddd��ZG d d!� d!e�ZG d"d#� d#e�ZG d$d%� d%e�ZG d&d'� d'e�Z G d(d)� d)e�Z!G d*d+� d+e�Z"G d,d-� d-e�Z#dS ).z6
Test cases for the L{twisted.python.reflect} module.
� N)�deque)�reflect)�accumulateMethods�addMethodNamesToDict�fullyQualifiedName�prefixedMethodNames�prefixedMethods)�SynchronousTestCasec @ � e Zd ZdZdd� ZdS )�Basez`
A no-op class which can be used to verify the behavior of
method-discovering APIs.
c C � dS )z9
A no-op method which can be discovered.
N� ��selfr
r
�;/usr/lib/python3/dist-packages/twisted/test/test_reflect.py�method � zBase.methodN)�__name__�
__module__�__qualname__�__doc__r r
r
r
r r s r c @ � e Zd ZdZdS )�SubzF
A subclass of a class with a method which can be discovered.
N)r r r r r
r
r
r r $ � r c @ � e Zd ZdZdd� Zdd� ZdS )�Separatez=
A no-op class with methods with differing prefixes.
c C r )zJ
A no-op method which a matching prefix to be discovered.
Nr
r r
r
r �good_method/ r zSeparate.good_methodc C r )zO
A no-op method with a mismatched prefix to not be discovered.
Nr
r r
r
r �
bad_method4 r zSeparate.bad_methodN)r r r r r r r
r
r
r r * s r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �AccumulateMethodsTestszt
Tests for L{accumulateMethods} which finds methods on a class hierarchy and
adds them to a dictionary.
c C �* t � }i }t||� | �d|ji|� dS )z�
If x is and instance of Base and Base defines a method named method,
L{accumulateMethods} adds an item to the given dictionary with
C{"method"} as the key and a bound method object for Base.method value.
r N)r r �assertEqualr �r �x�outputr
r
r �
test_ownClass@ s
z$AccumulateMethodsTests.test_ownClassc C r )a
If x is an instance of Sub and Sub is a subclass of Base and Base
defines a method named method, L{accumulateMethods} adds an item to the
given dictionary with C{"method"} as the key and a bound method object
for Base.method as the value.
r N)r r r r r! r
r
r �test_baseClassK s
z%AccumulateMethodsTests.test_baseClassc C s, t � }i }t||d� | �d|ji|� dS )z�
If a prefix is given, L{accumulateMethods} limits its results to
methods beginning with that prefix. Keys in the resulting dictionary
also have the prefix removed from them.
�good_r N)r r r r r! r
r
r �test_prefixW s z"AccumulateMethodsTests.test_prefixN)r r r r r$ r% r'