%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����dZddlZddlZddlmZmZddlmZGd�d�ZGd�d�Z	dd	�Z
d
�ZGd�dej�Z
Gd
�dej�Zy)z(
Tests for L{twisted.persisted.styles}.
�N)�_UniversalPicklingError�unpickleMethod)�unittestc��eZdZdZdd�Zd�Zy)�Foo�
    Helper class.
    Nc��d|_y)N�
test-value��instance_member��selfs �D/usr/lib/python3/dist-packages/twisted/persisted/test/test_styles.py�__init__zFoo.__init__s
��+���c��|jS)z 
        Helper method.
        rr
s r�methodz
Foo.methods���#�#�#r��returnN)�__name__�
__module__�__qualname__�__doc__rr�rrrrs���,�$rrc��eZdZdZy)�BarrN)rrrrrrrrrs��rrc��y)z)
    A sample function for pickling.
    Nrrrr�sampleFunctionr$s�rc��|S)Nr)�xs r�<lambda>r!*s��!�rc��eZdZdZd�Zdd�Zy)�UniversalPicklingErrorTestsz9
    Tests the L{_UniversalPicklingError} exception.
    c��t�)z2
        Raise L{UniversalPicklingError}.
        )rr
s r�raise_UniversalPicklingErrorz8UniversalPicklingErrorTests.raise_UniversalPicklingError2s
��&�%rNc�X�|jtj|j�y)z^
        Handling L{pickle.PicklingError} handles
        L{_UniversalPicklingError}.
        N)�assertRaises�pickle�
PicklingErrorr%r
s r�test_handledByPickleModulez6UniversalPicklingErrorTests.test_handledByPickleModule8s ��
	
���&�.�.��0Q�0Q�Rrr)rrrrr%r*rrrr#r#-s���&�Srr#c�@�eZdZdZd	d�Zd	d�Zd	d�Zd	d�Zd	d�Zd	d�Z	y)
�UnpickleMethodTestsz0
    Tests for the unpickleMethod function.
    Nc��t�}td|t�}|j||j�|j	||j�y)zj
        L{unpickleMethod} returns an instance method bound to the
        instance passed to it.
        rN)rr�assertEqualr�assertIsNot�r�foo�ms   r� test_instanceBuildingNamePresentz4UnpickleMethodTests.test_instanceBuildingNamePresentEsA��
�e���8�S�#�.������C�J�J�'�����C�J�J�'rc�0�t�}tj|j�}|j||j�|j	||j�|jd|��d|_|jd|��y)za
        Copying an instance method returns a new method with the same
        behavior.
        r
z	new-valueN)r�copyrr.r/rr0s   r�test_instanceCopyMethodz+UnpickleMethodTests.test_instanceCopyMethodOsq��
�e���I�I�c�j�j�!������C�J�J�'�����C�J�J�'�����q�s�+�)�������a�c�*rc��t�}td|t�}|j||j�|j||j�y)z�
        If the named method is not present in the class,
        L{unpickleMethod} finds a method on the class of the instance
        and returns a bound method from there.
        rN)rrrr.rr/r0s   r�#test_instanceBuildingNameNotPresentz7UnpickleMethodTests.test_instanceBuildingNameNotPresent\sA���e���8�S�#�.������C�J�J�'�����C�J�J�'rc�b�tjt�}|j|t�y)zi
        Copying a function returns the same reference, without creating
        an actual copy.
        N)r5rr.)r�fs  r�test_copyFunctionz%UnpickleMethodTests.test_copyFunctiongs"��

�I�I�n�%������N�+rc�l�d�}|jtjtd��|d��y)zd
        We do not contaminate normal function pickling with concerns from
        Twisted.
        c�z�djdtztjd|zdg�jd�S)N�
�c�p�.�ascii)�joinrr�encode)�ns r�expectedz9UnpickleMethodTests.test_primeDirective.<locals>.expectedus6���9�9��x���!8�!8�#��'�3�G���f�W�o�
rr)�protocol�0N)r.r(�dumpsr)rrFs  r�test_primeDirectivez'UnpickleMethodTests.test_primeDirectiveos(��	�
	
������n�q�A�8�C�=�Qrc�j�|jtjtjt�y)zY
        Pickling a C{lambda} function ought to raise a L{pickle.PicklingError}.
        N)r'r(r)rI�
lambdaExampler
s r�test_lambdaRaisesPicklingErrorz2UnpickleMethodTests.test_lambdaRaisesPicklingError|s ��	
���&�.�.����m�Lrr)
rrrrr3r6r8r;rJrMrrrr,r,@s'���(�+�	(�,�R�Mrr,r)rr5r(�twisted.persisted.stylesrr�
twisted.trialrrrrrL�TestCaser#r,rrr�<module>rQsb����
�L�"�$�$�����
�S�(�"3�"3�S�&@M�(�+�+�@Mr

Zerion Mini Shell 1.0