§
    Ètºfê  ã                   óÄ   — d Z ddlZddlZddlmZmZ ddlmZ  G d„ d¦  «        Z G d„ d¦  «        Z	dd
„Z
d„ Z G d„ dej        ¦  «        Z G d„ dej        ¦  «        ZdS )z(
Tests for L{twisted.persisted.styles}.
é    N)Ú_UniversalPicklingErrorÚunpickleMethod)Úunittestc                   ó    — e Zd ZdZdd„Zd„ ZdS )ÚFooú
    Helper class.
    ÚreturnNc                 ó   — d| _         d S )Nú
test-value©Úinstance_member©Úselfs    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/persisted/test/test_styles.pyÚ__init__zFoo.__init__   s   € Ø+ˆÔÐÐó    c                 ó   — | j         S )z 
        Helper method.
        r   r   s    r   Úmethodz
Foo.method   s   € ð Ô#Ð#r   ©r	   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      sA   € € € € € ðð ð,ð ,ð ,ð ,ð$ð $ð $ð $ð $r   r   c                   ó   — e Zd ZdZdS )ÚBarr   N)r   r   r   r   r   r   r   r   r      s   € € € € € ðð ð ð r   r   r	   c                  ó   — dS )z)
    A sample function for pickling.
    Nr   r   r   r   ÚsampleFunctionr   $   s   € € € r   c                 ó   — | S )Nr   )Úxs    r   ú<lambda>r!   *   s   € ˜!€ r   c                   ó    — e Zd ZdZd„ Zdd„ZdS )ÚUniversalPicklingErrorTestsz9
    Tests the L{_UniversalPicklingError} exception.
    c                 ó   — t           ‚)z2
        Raise L{UniversalPicklingError}.
        )r   r   s    r   Úraise_UniversalPicklingErrorz8UniversalPicklingErrorTests.raise_UniversalPicklingError2   s
   € õ &Ð%r   r	   Nc                 óP   — |                       t          j        | j        ¦  «         dS )z^
        Handling L{pickle.PicklingError} handles
        L{_UniversalPicklingError}.
        N)ÚassertRaisesÚpickleÚPicklingErrorr%   r   s    r   Útest_handledByPickleModulez6UniversalPicklingErrorTests.test_handledByPickleModule8   s&   € ð
 	×Ò�&Ô.°Ô0QÑRÔRÐRÐRÐRr   r   )r   r   r   r   r%   r*   r   r   r   r#   r#   -   sG   € € € € € ðð ð&ð &ð &ðSð Sð Sð Sð Sð Sr   r#   c                   óB   — e Zd ZdZd
d„Zd
d„Zd
d„Zd
d„Zd
d„Zd
d	„Z	dS )ÚUnpickleMethodTestsz0
    Tests for the unpickleMethod function.
    r	   Nc                 óº   — t          ¦   «         }t          d|t           ¦  «        }|                      ||j        ¦  «         |                      ||j        ¦  «         dS )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   sT   € õ
 ‰eŒeˆÝ˜8 S­#Ñ.Ô.ˆØ×Ò˜˜CœJÑ'Ô'Ð'Ø×Ò˜˜CœJÑ'Ô'Ð'Ð'Ð'r   c                 óF  — t          ¦   «         }t          j        |j        ¦  «        }|                      ||j        ¦  «         |                      ||j        ¦  «         |                      d |¦   «         ¦  «         d|_        |                      d |¦   «         ¦  «         dS )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   s”   € õ
 ‰eŒeˆÝŒI�c”jÑ!Ô!ˆØ×Ò˜˜CœJÑ'Ô'Ð'Ø×Ò˜˜CœJÑ'Ô'Ð'Ø×Ò˜ q q¡s¤sÑ+Ô+Ð+Ø)ˆÔØ×Ò˜ a a¡c¤cÑ*Ô*Ð*Ð*Ð*r   c                 óº   — t          ¦   «         }t          d|t          ¦  «        }|                      ||j        ¦  «         |                      ||j        ¦  «         dS )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\   sT   € õ ‰eŒeˆÝ˜8 S­#Ñ.Ô.ˆØ×Ò˜˜CœJÑ'Ô'Ð'Ø×Ò˜˜CœJÑ'Ô'Ð'Ð'Ð'r   c                 ón   — t          j         t          ¦  «        }|                      |t          ¦  «         dS )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/   € õ
 ŒI•nÑ%Ô%ˆØ×Ò˜�NÑ+Ô+Ð+Ð+Ð+r   c                 ó|   — d„ }|                       t          j        t          d¬¦  «         |d¦  «        ¦  «         dS )zd
        We do not contaminate normal function pickling with concerns from
        Twisted.
        c                 ó„   — d                      dt          z   t          j        d| z   dg¦  «                             d¦  «        S )Nú
ÚcÚpú.Úascii)Újoinr   r   Úencode)Úns    r   Úexpectedz9UnpickleMethodTests.test_primeDirective.<locals>.expectedu   s:   € Ø—9’9Ø•x‘¥Ô!8¸#À¹'À3ÐGñô çŠf�W‰oŒoðr   r   )ÚprotocolÚ0N)r.   r(   Údumpsr   )r   rF   s     r   Útest_primeDirectivez'UnpickleMethodTests.test_primeDirectiveo   sF   € ð	ð 	ð 	ð
 	×Ò�œ¥n¸qÐAÑAÔAÀ8À8ÈCÁ=Ä=ÑQÔQÐQÐQÐQr   c                 óf   — |                       t          j        t          j        t          ¦  «         dS )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ÑLÔLÐLÐLÐLr   r   )
r   r   r   r   r3   r6   r8   r;   rJ   rM   r   r   r   r,   r,   @   s    € € € € € ðð ð(ð (ð (ð (ð+ð +ð +ð +ð	(ð 	(ð 	(ð 	(ð,ð ,ð ,ð ,ðRð Rð Rð RðMð Mð Mð Mð Mð Mr   r,   r   )r   r5   r(   Útwisted.persisted.stylesr   r   Útwisted.trialr   r   r   r   rL   ÚTestCaser#   r,   r   r   r   ú<module>rQ      s:  ððð ð €€€Ø €€€à LÐ LÐ LÐ LÐ LÐ LÐ LÐ LØ "Ð "Ð "Ð "Ð "Ð "ð$ð $ð $ð $ð $ñ $ô $ð $ðð ð ð ð ñ ô ð ðð ð ð ð �€ðSð Sð Sð Sð S (Ô"3ñ Sô Sð Sð&@Mð @Mð @Mð @Mð @M˜(Ô+ñ @Mô @Mð @Mð @Mð @Mr   