%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_reflect.cpython-312.pyc

�

Ϫ�f�_���dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZddl
mZGd�d�ZGd	�d
e�ZGd�d�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�ZGd�d�ZGd�de�ZGd�d�ZGd�dee�Zedefddd��ZGd �d!e�ZGd"�d#e�ZGd$�d%e�ZGd&�d'e�Z Gd(�d)e�Z!Gd*�d+e�Z"Gd,�d-e�Z#y).z6
Test cases for the L{twisted.python.reflect} module.
�N)�deque)�reflect)�accumulateMethods�addMethodNamesToDict�fullyQualifiedName�prefixedMethodNames�prefixedMethods)�SynchronousTestCasec��eZdZdZd�Zy)�Basez`
    A no-op class which can be used to verify the behavior of
    method-discovering APIs.
    c��y)z9
        A no-op method which can be discovered.
        N���selfs �;/usr/lib/python3/dist-packages/twisted/test/test_reflect.py�methodzBase.method���N)�__name__�
__module__�__qualname__�__doc__rrrrrrs���
rrc��eZdZdZy)�SubzF
    A subclass of a class with a method which can be discovered.
    N)rrrrrrrrr$s��rrc��eZdZdZd�Zd�Zy)�Separatez=
    A no-op class with methods with differing prefixes.
    c��y)zJ
        A no-op method which a matching prefix to be discovered.
        Nrrs r�good_methodzSeparate.good_method/rrc��y)zO
        A no-op method with a mismatched prefix to not be discovered.
        Nrrs r�
bad_methodzSeparate.bad_method4rrN)rrrrrr rrrrr*s����
rrc�"�eZdZdZd�Zd�Zd�Zy)�AccumulateMethodsTestszt
    Tests for L{accumulateMethods} which finds methods on a class hierarchy and
    adds them to a dictionary.
    c�p�t�}i}t||�|jd|ji|�y)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.
        rN)rr�assertEqualr�r�x�outputs   r�
test_ownClassz$AccumulateMethodsTests.test_ownClass@s3��
�F�����!�V�$����(�A�H�H�-�v�6rc�p�t�}i}t||�|jd|ji|�y)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.
        rN)rrr$rr%s   r�test_baseClassz%AccumulateMethodsTests.test_baseClassKs3��
�E�����!�V�$����(�A�H�H�-�v�6rc�r�t�}i}t||d�|jd|ji|�y)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_rN)rrr$rr%s   r�test_prefixz"AccumulateMethodsTests.test_prefixWs5��
�J�����!�V�W�-����(�A�M�M�2�F�;rN)rrrrr(r*r-rrrr"r":s���
	7�
7�	<rr"c��eZdZdZd�Zd�Zy)�PrefixedMethodsTestszr
    Tests for L{prefixedMethods} which finds methods on a class hierarchy and
    adds them to a dictionary.
    c�h�t�}t|�}|j|jg|�y)zc
        L{prefixedMethods} returns a list of the methods discovered on an
        object.
        N)rr	r$rr%s   r�test_onlyObjectz$PrefixedMethodsTests.test_onlyObjectis+��

�F�� ��#�����!�(�(��V�,rc�j�t�}t|d�}|j|jg|�y)zo
        If a prefix is given, L{prefixedMethods} returns only methods named
        with that prefix.
        r,N)rr	r$rr%s   rr-z PrefixedMethodsTests.test_prefixrs-��

�J�� ��G�,�����!�-�-��&�1rN)rrrrr1r-rrrr/r/cs���
-�2rr/c��eZdZdZd�Zd�Zy)�PrefixedMethodNamesTestsz+
    Tests for L{prefixedMethodNames}.
    c�F�|jdgttd��y)z�
        L{prefixedMethodNames} returns a list including methods with the given
        prefix defined on the class passed to it.
        rr,N)r$rrrs r�test_methodz$PrefixedMethodNamesTests.test_method�s��
	
���(��%8��7�%K�Lrc�\�Gd�dt�}|jdgt|d��y)z�
        L{prefixedMethodNames} returns a list included methods with the given
        prefix defined on base classes of the class passed to it.
        c��eZdZy)�<PrefixedMethodNamesTests.test_inheritedMethod.<locals>.ChildN�rrrrrr�Childr9����rr;rr,N)rr$r)rr;s  r�test_inheritedMethodz-PrefixedMethodNamesTests.test_inheritedMethod�s*��	�H�	�	
���(��%8���%H�IrN)rrrrr6r=rrrr4r4|s���M�	Jrr4c��eZdZdZd�Zy)�AddMethodNamesToDictTestsz,
    Tests for L{addMethodNamesToDict}.
    c��Gd�d�}Gd�dt|�}i}t||d|�|jddi|�y)	z�
        If C{baseClass} is passed to L{addMethodNamesToDict}, only methods which
        are a subclass of C{baseClass} are added to the result dictionary.
        c��eZdZy)�;AddMethodNamesToDictTests.test_baseClass.<locals>.AlternateNr:rrr�	AlternaterB�r<rrCc��eZdZd�Zy)�7AddMethodNamesToDictTests.test_baseClass.<locals>.Childc��y�Nrrs r�good_alternatezFAddMethodNamesToDictTests.test_baseClass.<locals>.Child.good_alternate����rN)rrrrHrrrr;rE����
rr;r,�	alternate�N)rrr$)rrCr;�results    rr*z(AddMethodNamesToDictTests.test_baseClass�sD��	�	�	�H�i�	����U�F�G�Y�?����+�q�)�6�2rN)rrrrr*rrrr?r?�s���3rr?c��eZdZdZd�Zy)�Summerz9
    A class we look up as part of the LookupsTests.
    c��y)z
        Do something.
        Nrrs r�	reallySetzSummer.reallySet�rrN)rrrrrQrrrrOrO�s���rrOc�^�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�LookupsTestszC
    Tests for L{namedClass}, L{namedModule}, and L{namedAny}.
    c�V�|jtjd�t�y)zY
        L{namedClass} should return the class object for the name it is passed.
        � twisted.test.test_reflect.SummerN)�assertIsr�
namedClassrOrs r�test_namedClassLookupz"LookupsTests.test_namedClassLookup�s��	
�
�
�g�(�(�)K�L�f�Urc�Z�ddlm}|jtjd�|�y)zc
        L{namedModule} should return the module object for the name it is
        passed.
        r��monkey�twisted.python.monkeyN)�twisted.pythonr[rVr�namedModule�rr[s  r�test_namedModuleLookupz#LookupsTests.test_namedModuleLookup�s!��
	*��
�
�g�)�)�*A�B�F�Krc�j�ddl}|jtjd�|j�y)zY
        L{namedAny} should return the package object for the name it is passed.
        rN�twisted.python)r]rVr�namedAny�python�r�twisteds  r�test_namedAnyPackageLookupz'LookupsTests.test_namedAnyPackageLookup�s%��	��
�
�g�&�&�'7�8�'�.�.�Irc�Z�ddlm}|jtjd�|�y)zX
        L{namedAny} should return the module object for the name it is passed.
        rrZr\N)r]r[rVrrcr_s  r�test_namedAnyModuleLookupz&LookupsTests.test_namedAnyModuleLookup�s!��	*��
�
�g�&�&�'>�?��Hrc�V�|jtjd�t�y)zW
        L{namedAny} should return the class object for the name it is passed.
        rUN)rVrrcrOrs r�test_namedAnyClassLookupz%LookupsTests.test_namedAnyClassLookup�s��	
�
�
�g�&�&�'I�J�F�Src�j�|jtjd�tj�y)z�
        L{namedAny} should return the object an attribute of a non-module,
        non-package object is bound to for the name it is passed.
        z*twisted.test.test_reflect.Summer.reallySetN)r$rrcrOrQrs r�test_namedAnyAttributeLookupz)LookupsTests.test_namedAnyAttributeLookup�s*��	
������I�J����	
rc�~�|jtjd�tjj
�y)z�
        L{namedAny} should return the object an attribute of an object which
        itself was an attribute of a non-module, non-package object is bound to
        for the name it is passed.
        z2twisted.test.test_reflect.Summer.reallySet.__doc__N)rVrrcrOrQrrs r�"test_namedAnySecondAttributeLookupz/LookupsTests.test_namedAnySecondAttributeLookup�s.��	
�
�
����T�U����$�$�	
rc�,�|jttjd�|jttjd�|jttjd�|jt
tjd�y)z�
        Exceptions raised by modules which L{namedAny} causes to be imported
        should pass through L{namedAny} to the caller.
        ztwisted.test.reflect_helper_ZDEztwisted.test.reflect_helper_VEztwisted.test.reflect_helper_IEN)�assertRaises�ZeroDivisionErrorrrc�
ValueError�ImportErrorrs r�test_importExceptionsz"LookupsTests.test_importExceptions�sz��
	
����w�/�/�1R�	
�	
����w�/�/�1R�	
�	
�����(�(�*J�	
�
	
�����)�)�+K�	
rc���|jttjd�|jttjd�|jttjd�y)z�
        If segments on the end of a fully-qualified Python name represents
        attributes which aren't actually present on the object represented by
        the earlier segments, L{namedAny} should raise an L{AttributeError}.
        ztwisted.nosuchmoduleintheworldz twisted.nosuch.modulein.theworldz0twisted.test.test_reflect.Summer.nosuchattributeN)rq�AttributeErrorrrcrs r�test_attributeExceptionsz%LookupsTests.test_attributeExceptions
s]��	
����G�,�,�.N�	
�	
����G�,�,�.P�	
�	
�������>�	
rc��|jtjtjd�}|j	t|�d�|jtjtjd�}|j	t|�d�|jtjtjd�}|j	t|�d�|jtjtjd�}|j	t|�d�d	D]O}|jtjtj|�}|j	t|�d
|����Qy)a�
        Passing a name which isn't a fully-qualified Python name to L{namedAny}
        should result in one of the following exceptions:
         - L{InvalidName}: the name is not a dot-separated list of Python
           objects
         - L{ObjectNotFound}: the object doesn't exist
         - L{ModuleNotFound}: the object doesn't exist and there is only one
           component in the name
        �nosuchmoduleintheworldz(No module named 'nosuchmoduleintheworld'z@#$@(#.!@(#!@#z('@#$@(#.!@(#!@#' does not name an objectztcelfer.nohtyp.detsiwtz0'tcelfer.nohtyp.detsiwt' does not name an object�zEmpty module name)z.twistedztwisted.ztwisted..pythonzMname must be a string giving a '.'-separated list of Python identifiers, not N)rqr�ModuleNotFoundrcr$�str�ObjectNotFound�InvalidName)r�err�invalidNames   r�test_invalidNameszLookupsTests.test_invalidNames"s8������"�"�G�$4�$4�6N�
��	
����S��#M�N�����"�"�G�$4�$4�6F�
��	
����S��#M�N�����"�"�G�$4�$4�6N�
��	
����S��#U�V����� 3� 3�W�5E�5E�r�J������S��#6�7�F�	�K��#�#�G�$7�$7��9I�9I�;�W�C�����C��)4�7�
�	rc�x�dD]5}t�}tj||��}|j||��7y)zk
        When module import fails with ImportError it returns the specified
        default value.
        )�nosuchmtopodule�no.such.module��defaultN)�objectr�
requireModulerV)r�namer�rMs    r�test_requireModuleImportErrorz*LookupsTests.test_requireModuleImportErrorGs:��
:�	+�D��h�G��*�*�4��A�F��M�M�&�'�*�	+rc�P�tjd�}|j|�y)zI
        When module import fails it returns L{None} by default.
        r�N)rr��assertIsNone)rrMs  r�test_requireModuleDefaultNonez*LookupsTests.test_requireModuleDefaultNoneSs#���&�&�'7�8�����&�!rc�r�ddlm}t�}|jt	j
d|��|�y)ze
        When module import succeed it returns the module and not the default
        value.
        rrZr\r�N)r]r[r�rVrr�)rr[r�s   r�!test_requireModuleRequestedImportz.LookupsTests.test_requireModuleRequestedImport[s.��
	*��(���
�
��!�!�"9�7�K��	
rN)rrrrrXr`rgrirkrmrorurxr�r�r�r�rrrrSrS�sN���V�L�J�I�T�
�	
�
�*
�*#�J
+�"�
rrSc�,�eZdZdZdZdefd�Zdefd�Zy)�	BreakableF�returnc�2�|jrtd��y)Nzstr!z<Breakable>)�breakStr�RuntimeErrorrs r�__str__zBreakable.__str__ns���=�=��v�&�&� rc�2�|jrtd��y)Nzrepr!zBreakable())�	breakReprr�rs r�__repr__zBreakable.__repr__ts���>�>��w�'�'� rN)rrrr�r�r}r�r�rrrr�r�js$���I��H�!��!�!�#�!rr�c� �eZdZdZed��Zy)�
BrokenTypeFc�2�|jrtd��y)Nzno namer�)�	breakNamer�rs rrzBrokenType.__name__~s���>�>��y�)�)�rN)rrrr��propertyrrrr�r�{s���I�
���rr��BTBaseT)r�r�c��eZdZed��Zy)�NoClassAttrc��|jSrG)�	not_class)r&s r�<lambda>zNoClassAttr.<lambda>�s
��1�;�;�rN)rrrr��	__class__rrrr�r��s
���.�/�Irr�c�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�
SafeReprTestsz2
    Tests for L{reflect.safe_repr} function.
    c	��gd�df}|jtttj|��ttt
|���y)zg
        L{reflect.safe_repr} produces the same output as C{repr} on a working
        object.
        �rL���aN)r$�list�mapr�	safe_repr�repr)r�xss  r�test_workingReprzSafeReprTests.test_workingRepr�s;��
��
������c�'�"3�"3�R�8�9�4��D�"�
�;N�Orc��t�}d|_tj|�}|j	d|�|j	t
jjt�d|�|j	d|�y)z�
        L{reflect.safe_repr} returns a string with class name, address, and
        traceback when the repr call failed.
        TzBreakable instance at 0xr�RuntimeError: repr!N)	r�r�rr��assertIn�os�path�splitext�__file__�r�b�bReprs   r�test_brokenReprzSafeReprTests.test_brokenRepr�sd��

�K������!�!�!�$���
�
�0�%�8�	
�
�
�b�g�g�&�&�x�0��3�U�;��
�
�+�U�3rc��t�}d|_|jtj|�t|��y)zT
        L{reflect.safe_repr} isn't affected by a broken C{__str__} method.
        TN)r�r�r$rr�r��rr�s  r�test_brokenStrzSafeReprTests.test_brokenStr�s1��
�K����
�����*�*�1�-�t�A�w�7rc��Gd�dt�}tj|�tj|��y)Nc��eZdZdZy)�-SafeReprTests.test_brokenClassRepr.<locals>.XTN�rrrr�rrr�Xr������Irr��r�rr��rr�s  r�test_brokenClassReprz"SafeReprTests.test_brokenClassRepr�s.��	��	�	���!�����!�#�rc��Gd�dt�}tj|�}dt|�d�d�}|j	||jd�d�y)	z�
        C{id} is used to print the ID of the object in case of an error.

        L{safe_repr} includes a traceback after a newline, so we only check
        against the first line of the repr.
        c��eZdZdZy)�2SafeReprTests.test_brokenReprIncludesID.<locals>.XTNr�rrrr�r��r�rr�z<BrokenType instance at 0xr&z with repr error:�
rN)r�rr��idr$�split)rr��xRepr�
xReprExpecteds    r�test_brokenReprIncludesIDz'SafeReprTests.test_brokenReprIncludesID�sS��	��	��!�!�!�$��4�R��U�1�I�=N�O�
��������D�(9�!�(<�=rc��Gd�dt�}tj|�tj|��y)Nc��eZdZdZy)�,SafeReprTests.test_brokenClassStr.<locals>.XTN�rrrr�rrrr�r������Hrr�r�r�s  r�test_brokenClassStrz!SafeReprTests.test_brokenClassStr�s.��	��	�	���!�����!�#�rc��t�}d|_tj|�}|j	d|�|j	t
jjt�d|�|j	d|�y)z�
        If an object raises an exception when accessing its C{__class__}
        attribute, L{reflect.safe_repr} uses C{type} to retrieve the class
        object.
        T�NoClassAttr instance at 0xrr�N)	r�r�rr�r�r�r�r�r�r�s   r�test_brokenClassAttributez'SafeReprTests.test_brokenClassAttribute�sb��
�M������!�!�!�$���
�
�2�E�:��
�
�b�g�g�&�&�x�0��3�U�;��
�
�+�U�3rc�
�Gd�dt�}tj|��}|jd|�|jtj
j
t�d|�|jd|�y)z�
        If a class raises an exception when accessing its C{__name__} attribute
        B{and} when calling its C{__str__} implementation, L{reflect.safe_repr}
        returns 'BROKEN CLASS' instead of the class name.
        c��eZdZdZy)�6SafeReprTests.test_brokenClassNameAttribute.<locals>.XTN�rrrr�rrrr�r��r�rr��<BROKEN CLASS AT 0xrr�N)r�rr�r�r�r�r�r�)rr�r�s   r�test_brokenClassNameAttributez+SafeReprTests.test_brokenClassNameAttribute�sb��	��	��!�!�!�#�&���
�
�+�U�3��
�
�b�g�g�&�&�x�0��3�U�;��
�
�+�U�3rN)rrrrr�r�r�r�r�r�r�r�rrrr�r��s0���P�4�8��
>��4�
4rr�c�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�SafeStrTestsz1
    Tests for L{reflect.safe_str} function.
    c�h�gd�}|jtj|�t|��y)Nr�)r$r�safe_strr}�rr&s  r�test_workingStrzSafeStrTests.test_workingStr�s&��������)�)�!�,�c�!�f�5rc�P�t�}d|_tj|�y�NT)r�r�rr�r�s  rr�zSafeStrTests.test_brokenStr�s���K����
�����rc�R�d}|jtj|�d�y)zh
        L{safe_str} for C{str} with ascii-only data should return the
        value unchanged.
        �aN)r$rr�r�s  r�test_workingAsciizSafeStrTests.test_workingAscii�s$��

������)�)�!�,�c�2rc�p�d}|jtj|�|jd��y)zw
        L{safe_str} for C{bytes} with utf-8 encoded data should return
        the value decoded into C{str}.
        stüst�utf-8N)r$rr��decoder�s  r�test_workingUtf8_3zSafeStrTests.test_workingUtf8_3�s-��

������)�)�!�,�a�h�h�w�.?�@rc�h�d}tj|�}|j|t|��y)z=
        Use str() for non-utf8 bytes: "b'non-utf8'"
        ��N)rr�r$r})rr&�xStrs   r�test_brokenUtf8zSafeStrTests.test_brokenUtf8s-��
������"������s�1�v�&rc�P�t�}d|_tj|�yr�)r�r�rr�r�s  rr�zSafeStrTests.test_brokenReprs���K���������rc��Gd�dt�}tj|�tj|��y)Nc��eZdZdZy)�+SafeStrTests.test_brokenClassStr.<locals>.XTNr�rrrr�r�r�rr��r�rr�r�s  rr�z SafeStrTests.test_brokenClassStrs.��	��	�	����������rc��Gd�dt�}tj|�tj|��y)Nc��eZdZdZy)�,SafeStrTests.test_brokenClassRepr.<locals>.XTNr�rrrr�r�r�rr�r�r�s  rr�z!SafeStrTests.test_brokenClassReprs.��	��	�	����������rc��t�}d|_tj|�}|j	d|�|j	t
jjt�d|�|j	d|�y)z�
        If an object raises an exception when accessing its C{__class__}
        attribute, L{reflect.safe_str} uses C{type} to retrieve the class
        object.
        Tr�r�RuntimeError: str!N)	r�r�rr�r�r�r�r�r�)rr��bStrs   rr�z&SafeStrTests.test_brokenClassAttribute"sb��
�M����
�����"���
�
�2�D�9��
�
�b�g�g�&�&�x�0��3�T�:��
�
�*�D�1rc�
�Gd�dt�}tj|��}|jd|�|jtj
j
t�d|�|jd|�y)z�
        If a class raises an exception when accessing its C{__name__} attribute
        B{and} when calling its C{__str__} implementation, L{reflect.safe_str}
        returns 'BROKEN CLASS' instead of the class name.
        c��eZdZdZy)�5SafeStrTests.test_brokenClassNameAttribute.<locals>.XTNr�rrrr�r6r�rr�r�rr�N)r�rr�r�r�r�r�r�)rr�r�s   rr�z*SafeStrTests.test_brokenClassNameAttribute/sb��	��	������$���
�
�+�T�2��
�
�b�g�g�&�&�x�0��3�T�:��
�
�*�D�1rN)rrrrr�r�r�r�r�r�r�r�r�r�rrrr�r��s:���6��
3�A�'��
��2�
2rr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�FilenameToModuleTestsz1
    Test L{filenameToModuleName} detection.
    c�L�tjj|j�dd�|_tj|j�ttjj|jd�d�5}|j
d�ddd�ttjjtjj|j�d�d�5}|j
d�ddd�y#1swY�uxYw#1swYyxYw)N�fakepackage�testz__init__.py�wr{)r�r��join�mktemp�makedirs�open�write�dirname)r�fs  r�setUpzFilenameToModuleTests.setUpDs����G�G�L�L�����
�v�F��	�
���D�I�I��
�"�'�'�,�,�t�y�y�-�8�#�
>�	�!�
�G�G�B�K�	�
�"�'�'�,�,�r�w�w���t�y�y�9�=�I�3�
O�	�ST�
�G�G�B�K�	�	�	�	��	�	�s�D�3D�D�D#c��tj|j�}|j|d�tj|jtjj
z�}|j|d�y)zk
        L{filenameToModuleName} returns the correct module (a package) given a
        directory.
        zfakepackage.testN)r�filenameToModuleNamer�r$r��sep�r�modules  r�test_directoryz$FilenameToModuleTests.test_directoryLs[��
�-�-�d�i�i�8������!3�4��-�-�d�i�i�"�'�'�+�+�.E�F������!3�4rc��tjtjj	|jd��}|j|d�y)zh
        L{filenameToModuleName} returns the correct module given the path to
        its file.
        ztest_reflect.py�fakepackage.test.test_reflectN)rrr�r�r
r$rs  r�	test_filezFilenameToModuleTests.test_fileVs>��
�-�-��G�G�L�L����$5�6�
��	
����!@�Arc��tjtjj	|jjd�d��}|j
|d�y)zo
        L{filenameToModuleName} returns the correct module given a C{bytes}
        path to its file.
        r�stest_reflect.pyrN)rrr�r�r
�encoder$rs  r�
test_bytesz FilenameToModuleTests.test_bytes`sI��
�-�-��G�G�L�L����)�)�'�2�4F�G�
��	
����!@�ArN)rrrrrrrrrrrrr?s����5�B�	Brrc�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�FullyQualifiedNameTestsz)
    Test for L{fullyQualifiedName}.
    c�:�|jt|�|�y)ze
        Helper to check that fully qualified name of C{obj} results to
        C{expected}.
        N)r$r)r�obj�expecteds   r�_checkFullyQualifiedNamez0FullyQualifiedNameTests._checkFullyQualifiedNameqs��
	
���+�C�0�(�;rc�p�ddl}|j|d�ddl}|j|jd�y)zd
        L{fullyQualifiedName} returns the full name of a package and a
        subpackage.
        rNrfrb)rfr#r]rdres  r�test_packagez$FullyQualifiedNameTests.test_packagexs/��
	��%�%�g�y�9���%�%�g�n�n�6F�Grc�X�ddl}|j|jjd�y)zV
        L{fullyQualifiedName} returns the name of a module inside a package.
        rNztwisted.python.compat)�twisted.python.compatr#rd�compatres  r�test_modulez#FullyQualifiedNameTests.test_module�s"��	%��%�%�g�n�n�&;�&;�=T�Urc�>�|jtt�d��y)zS
        L{fullyQualifiedName} returns the name of a class and its module.
        z.FullyQualifiedNameTestsN)r#rrrs r�
test_classz"FullyQualifiedNameTests.test_class�s��	
�%�%�#��z�1I�%J�	
rc�0�|jtd�y)zY
        L{fullyQualifiedName} returns the name of a function inside its module.
        z)twisted.python.reflect.fullyQualifiedNameN)r#rrs r�
test_functionz%FullyQualifiedNameTests.test_function�s��	
�%�%�� K�	
rc�x�|j|jt�d|jj�d��y)zs
        L{fullyQualifiedName} returns the name of a bound method inside its
        class and its module.
        �.z.test_boundMethodN)r#�test_boundMethodrr�rs rr0z(FullyQualifiedNameTests.test_boundMethod�s7��
	
�%�%��!�!��j��$�.�.�1�1�2�2C�D�	
rc��|j|jjt�d|jj�d��y)zv
        L{fullyQualifiedName} returns the name of an unbound method inside its
        class and its module.
        r/z.test_unboundMethodN)r#r��test_unboundMethodrrs rr2z*FullyQualifiedNameTests.test_unboundMethod�s;��
	
�%�%��N�N�-�-��j��$�.�.�1�1�2�2E�F�	
rN)rrrrr#r%r)r+r-r0r2rrrrrls,���<�
H�V�
�
�
�
rrc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�ObjectGrepTestsc��t�}d|i}|di}|jdtj||tj��|jdtj||tj��y)zV
        Test references search through a dictionary, as a key or as a value.
        Nz[None]z{None}�r�r�r�objgrep�isSame)r�o�d1�d2s    r�test_dictionaryzObjectGrepTests.test_dictionary�s[��
�H���A�Y����Y���
�
�h�����A�w�~�~� F�G��
�
�h�����A�w�~�~� F�Grc��t�}d|g}|jdtj||tj��y)z8
        Test references search through a list.
        N�[1]r6)rr9�Ls   r�	test_listzObjectGrepTests.test_list�s3��
�H��
�1�I���
�
�e�W�_�_�Q��7�>�>�B�Crc��t�}|df}|jdtj||tj��y)z9
        Test references search through a tuple.
        N�[0]r6)rr9�Ts   r�
test_tuplezObjectGrepTests.test_tuple�s3��
�H��
��I���
�
�e�W�_�_�Q��7�>�>�B�Crc��Gd�d�}t�}|�}||_|jdtj||tj
��y)zE
        Test references search through an object attribute.
        c��eZdZy)�,ObjectGrepTests.test_instance.<locals>.DummyNr:rrr�DummyrG�r<rrHz.oN)r�r9r�rr7r8)rrHr9�ds    r�
test_instancezObjectGrepTests.test_instance�sB��
	�	�
�H���G������
�
�d�G�O�O�A�q�'�.�.�A�Brc��Gd�d�}|�}tj|�}|jdtj||tj
��y)zB
        Test references search through a weakref object.
        c��eZdZy)�+ObjectGrepTests.test_weakref.<locals>.DummyNr:rrrrHrM�r<rrHz()N)�weakref�refr�rr7r8)rrHr9�w1s    r�test_weakrefzObjectGrepTests.test_weakref�sA��
	�	�
�G��
�[�[��^���
�
�d�G�O�O�B��7�>�>�B�Crc���Gd�d�}|�}|j}|jdtj||jtj
��|jdtj||jjtj
��|jdtj||jtj
��y)zK
        Test references search through method special attributes.
        c��eZdZd�Zy)�/ObjectGrepTests.test_boundMethod.<locals>.Dummyc��yrGrrs r�dummyz5ObjectGrepTests.test_boundMethod.<locals>.Dummy.dummy�rIrN)rrrrVrrrrHrT�rJrrHz	.__self__z.__self__.__class__z	.__func__N)rVr�rr7�__self__r8r��__func__)rrHr9�ms    rr0z ObjectGrepTests.test_boundMethod�s���
	�	�
�G��
�G�G���
�
�k�7�?�?�1�a�j�j�'�.�.�#Q�R��
�
�!��O�O�A�q�z�z�3�3�W�^�^�D�	
�	
�
�
�k�7�?�?�1�a�j�j�'�.�.�#Q�Rrc�*�Gd�d�}|�}dddd|di}dd|dg}|i|�f}d	d
|d�}|�}||_|j}tj|�}	|j	dtj|	|t
j��y)
zF
        Test references search using complex set of objects.
        c��eZdZd�Zy)�.ObjectGrepTests.test_everything.<locals>.Dummyc��yrGrrs rrz5ObjectGrepTests.test_everything.<locals>.Dummy.methodrIrN)rrrrrrrrHr\rJrrHr�bazN�Quux�Fooshr��foo�bar)rrLr�z"().__self__.attr[2][0][2]{'Foosh'})�attrrrNrOr�rr7r8)
rrHr9�D1r?rC�D2�irYr	s
          r�test_everythingzObjectGrepTests.test_everything�s���
	�	�
�G���%��v�q�'�
2��
�2�r�1���
��E�G����5�Q�
'���G�����
�H�H���K�K��N���
�
�0�'�/�/�!�Q����2W�	
rc	�r�g}|g}||g}||g}|jdgtj||tjd���|jddgtj||tjd���|jgd�tj||tjd���y)	z6
        Test the depth of references search.
        rBrL)�maxDepth�[1][0]r�)rBrjz	[1][1][0]r�N)r$rr7r8)rr�r��crIs     r�test_depthLimitzObjectGrepTests.test_depthLimits���
��
�C��
��F��
��F�����%��'�/�/�!�Q����QR�"S�T����
�H��w���q�!�W�^�^�a�P�	
�	
���*��O�O�A�q�'�.�.�1�=�	
rc���t�}t�}|jd�|j|�|jdt	j
||tj��y)z@
        Test references search through a deque object.
        Nr>)r�r�appendr�rr7r8)rr9�Ds   r�
test_dequezObjectGrepTests.test_deque&sG��
�H���G��	�����	������
�
�e�W�_�_�Q��7�>�>�B�CrN)rrrr<r@rDrJrQr0rgrlrprrrr4r4�s6��	H�D�D�C�D�S�&
�.
�$	Drr4c��eZdZd�Zy)�
GetClassTestsc���Gd�d�}|�}|jtj|�jd�|jtj|�jd�y)Nc��eZdZy)�(GetClassTests.test_new.<locals>.NewClassNr:rrr�NewClassru4r<rrv�type)r$r�getClassr)rrv�news   r�test_newzGetClassTests.test_new3sW��	�	��j������)�)�(�3�<�<�f�E�����)�)�#�.�7�7��DrN)rrrrzrrrrrrr2s��Errr)$rr�rN�collectionsrr]r�twisted.python.reflectrrrrr	�twisted.trial.unittestr
�TestCaserrrr"r/r4r?rOrSr�rwr�r�r�r�r�rrr4rrrrr�<module>rs*���

���"���C�	�	��$��
�
� &<�X�&<�R2�8�2�2J�x�J�03��3�.��q
�8�q
�h!�!�"��D��
�H�y�l�$�D�,Q�	R��0�)�0�Z4�H�Z4�zS2�8�S2�l*B�H�*B�ZB
�h�B
�J~D�h�~D�BE�H�Er

Zerion Mini Shell 1.0