File: //proc/self/root/lib/python3/dist-packages/twisted/test/__pycache__/test_reflect.cpython-38.pyc
U
W[�e � @ s� d Z ddlmZmZ ddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z ddlmZ dd lmZmZmZmZmZ G d
d� de�ZG dd
� d
e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd� de!e"�Z#e#d e!fd!d!d"��Z$G d#d$� d$e!�Z%G d%d&� d&e�Z&G d'd(� d(e�Z'G d)d*� d*e�Z(G d+d,� d,e�Z)G d-d.� d.ej�Z*G d/d0� d0ej�Z+dS )1z6
Test cases for the L{twisted.python.reflect} module.
� )�division�absolute_importN)�deque)�_PY3)�unittest)�SynchronousTestCase)�reflect)�accumulateMethods�prefixedMethods�prefixedMethodNames�addMethodNamesToDict�fullyQualifiedNamec @ s e Zd ZdZdd� ZdS )�Basez`
A no-op class which can be used to verify the behavior of
method-discovering APIs.
c C s dS )z9
A no-op method which can be discovered.
N� ��selfr r �;/usr/lib/python3/dist-packages/twisted/test/test_reflect.py�method s zBase.methodN)�__name__�
__module__�__qualname__�__doc__r r r r r r s r c @ s 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 $ s r c @ s e Zd ZdZdd� Zdd� ZdS )�Separatez=
A no-op class with methods with differing prefixes.
c C s dS )zJ
A no-op method which a matching prefix to be discovered.
Nr r r r r �good_method0 s zSeparate.good_methodc C s dS )zO
A no-op method with a mismatched prefix to not be discovered.
Nr r r r r �
bad_method6 s 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 s* 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_ownClassC s
z$AccumulateMethodsTests.test_ownClassc C s* t � }i }t||� | �d|ji|� dS )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_baseClassO 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_prefix\ s z"AccumulateMethodsTests.test_prefixN)r r r r r! r"