%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/persisted/test/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/persisted/test/__pycache__/test_styles.cpython-312.pyc |
� Ϫ�f� � � � d Z ddlZddlZddlmZmZ ddlmZ G d� d� Z G d� d� Z dd �Z d � Z G d� dej � Z G d � dej � Zy)z( Tests for L{twisted.persisted.styles}. � N)�_UniversalPicklingError�unpickleMethod)�unittestc � � e Zd ZdZdd�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__zFoo.__init__ s � �+��� c � � | j S )z Helper method. r r s r �methodz Foo.method s � � �#�#�#r ��returnN)�__name__� __module__�__qualname__�__doc__r r � r r r r s � ��,�$r r c � � e Zd ZdZy)�Barr N)r r r r r r r r r s � �r r c � � y)z) A sample function for pickling. Nr r r r �sampleFunctionr $ s � r c � � | S )Nr )�xs r �<lambda>r! * s � �!� r c � � e Zd ZdZd� Zdd�Zy)�UniversalPicklingErrorTestsz9 Tests the L{_UniversalPicklingError} exception. c � � t �)z2 Raise L{UniversalPicklingError}. )r r s r �raise_UniversalPicklingErrorz8UniversalPicklingErrorTests.raise_UniversalPicklingError2 s � � &�%r Nc �X � | j t j | j � y)z^ Handling L{pickle.PicklingError} handles L{_UniversalPicklingError}. N)�assertRaises�pickle� PicklingErrorr% r s r �test_handledByPickleModulez6UniversalPicklingErrorTests.test_handledByPickleModule8 s � � ���&�.�.��0Q�0Q�Rr r )r r r r r% r* r r r r# r# - s � ��&�Sr r# c �@ � e Zd ZdZd d�Zd d�Zd d�Zd d�Zd d�Zd d�Z y) �UnpickleMethodTestsz0 Tests for the unpickleMethod function. Nc � � t � }t d|t � }| j ||j � | j ||j � y)zj L{unpickleMethod} returns an instance method bound to the instance passed to it. r N)r r �assertEqualr �assertIsNot�r �foo�ms r � test_instanceBuildingNamePresentz4UnpickleMethodTests.test_instanceBuildingNamePresentE sA � � �e���8�S�#�.������C�J�J�'�����C�J�J�'r c �0 � t � }t j |j � }| j ||j � | j ||j � | j d |� � d|_ | j d |� � y)za Copying an instance method returns a new method with the same behavior. r z new-valueN)r �copyr r. r/ r r0 s r �test_instanceCopyMethodz+UnpickleMethodTests.test_instanceCopyMethodO sq � � �e���I�I�c�j�j�!������C�J�J�'�����C�J�J�'�����q�s�+�)�������a�c�*r c � � t � }t d|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. r N)r r r r. r r/ r0 s r �#test_instanceBuildingNameNotPresentz7UnpickleMethodTests.test_instanceBuildingNameNotPresent\ sA � � �e���8�S�#�.������C�J�J�'�����C�J�J�'r c �b � t j t � }| j |t � y)zi Copying a function returns the same reference, without creating an actual copy. N)r5 r r. )r �fs r �test_copyFunctionz%UnpickleMethodTests.test_copyFunctiong s"