ó
    Ö›‘hê  ã                   óÀ   • S r SSKrSSKrSSKJrJr  SSKJr   " S S5      r " S S5      r	SS	 jr
S
 r " S S\R                  5      r " S S\R                  5      rg)z(
Tests for L{twisted.persisted.styles}.
é    N)Ú_UniversalPicklingErrorÚunpickleMethod)Úunittestc                   ó(   • \ rS rSrSrSS jrS rSrg)ÚFooé   ú
Helper class.
Nc                 ó   • SU l         g )Nú
test-value©Úinstance_member©Úselfs    ÚfC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/persisted/test/test_styles.pyÚ__init__ÚFoo.__init__   s
   € Ø+ˆÕó    c                 ó   • U R                   $ )z
Helper method.
r   r   s    r   ÚmethodÚ
Foo.method   s   € ð ×#Ñ#Ð#r   r   ©ÚreturnN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__© r   r   r   r      s   † ñô,õ$r   r   c                   ó   • \ rS rSrSrSrg)ÚBaré   r	   r   N)r   r   r   r   r   r   r   r   r   r!   r!      s   † ôr   r!   c                  ó   • g)z!
A sample function for pickling.
Nr   r   r   r   ÚsampleFunctionr$   $   s   � r   c                 ó   • U $ )Nr   )Úxs    r   Ú<lambda>r'   *   s   € ™!r   c                   ó(   • \ rS rSrSrS rSS jrSrg)ÚUniversalPicklingErrorTestsé-   z1
Tests the L{_UniversalPicklingError} exception.
c                 ó   • [         e)z"
Raise L{UniversalPicklingError}.
)r   r   s    r   Úraise_UniversalPicklingErrorÚ8UniversalPicklingErrorTests.raise_UniversalPicklingError2   s
   € ô &Ð%r   Nc                 óX   • U R                  [        R                  U R                  5        g)zF
Handling L{pickle.PicklingError} handles
L{_UniversalPicklingError}.
N)ÚassertRaisesÚpickleÚPicklingErrorr,   r   s    r   Útest_handledByPickleModuleÚ6UniversalPicklingErrorTests.test_handledByPickleModule8   s    € ð
 	×Ñœ&×.Ñ.°×0QÑ0QÕRr   r   r   )r   r   r   r   r   r,   r2   r   r   r   r   r)   r)   -   s   † ñò&÷Sr   r)   c                   óT   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS	 jr
S
rg)ÚUnpickleMethodTestsé@   z(
Tests for the unpickleMethod function.
Nc                 ó¦   • [        5       n[        SU[         5      nU R                  X!R                  5        U R	                  X!R                  5        g)zR
L{unpickleMethod} returns an instance method bound to the
instance passed to it.
r   N)r   r   ÚassertEqualr   ÚassertIsNot©r   ÚfooÚms      r   Ú test_instanceBuildingNamePresentÚ4UnpickleMethodTests.test_instanceBuildingNamePresentE   s=   € ô
 ‹eˆÜ˜8 S¬#Ó.ˆØ×Ñ˜ŸJ™JÔ'Ø×Ñ˜ŸJ™JÕ'r   c                 ó.  • [        5       n[        R                  " UR                  5      nU R                  X!R                  5        U R	                  X!R                  5        U R                  SU" 5       5        SUl        U R                  SU" 5       5        g)zI
Copying an instance method returns a new method with the same
behavior.
r   z	new-valueN)r   Úcopyr   r8   r9   r   r:   s      r   Útest_instanceCopyMethodÚ+UnpickleMethodTests.test_instanceCopyMethodO   sm   € ô
 ‹eˆÜ�IŠI�c—j‘jÓ!ˆØ×Ñ˜ŸJ™JÔ'Ø×Ñ˜ŸJ™JÔ'Ø×Ñ˜¡q£sÔ+Ø)ˆÔØ×Ñ˜¡a£cÕ*r   c                 ó¦   • [        5       n[        SU[        5      nU R                  X!R                  5        U R                  X!R                  5        g)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!   r8   r   r9   r:   s      r   Ú#test_instanceBuildingNameNotPresentÚ7UnpickleMethodTests.test_instanceBuildingNameNotPresent\   s=   € ô ‹eˆÜ˜8 S¬#Ó.ˆØ×Ñ˜ŸJ™JÔ'Ø×Ñ˜ŸJ™JÕ'r   c                 ód   • [         R                   " [        5      nU R                  U[        5        g)zQ
Copying a function returns the same reference, without creating
an actual copy.
N)r@   r$   r8   )r   Úfs     r   Útest_copyFunctionÚ%UnpickleMethodTests.test_copyFunctiong   s"   € ô
 �IŠI”nÓ%ˆØ×Ñ˜œNÕ+r   c                 óh   • S nU R                  [        R                  " [        SS9U" S5      5        g)zL
We do not contaminate normal function pickling with concerns from
Twisted.
c                 óz   • SR                  S[        -   [        R                  SU -   S/5      R                  S5      $ )NÚ
ÚcÚpÚ.Úascii)Újoinr   r$   Úencode)Úns    r   ÚexpectedÚ9UnpickleMethodTests.test_primeDirective.<locals>.expectedu   s6   € Ø—9‘9Ø”x‘¤×!8Ñ!8¸#À¹'À3ÐGóç‰f�W‹oðr   r   )ÚprotocolÚ0N)r8   r0   Údumpsr$   )r   rT   s     r   Útest_primeDirectiveÚ'UnpickleMethodTests.test_primeDirectiveo   s(   € ò	ð
 	×ÑœŸš¤n¸qÑAÁ8ÈCÃ=ÕQr   c                 ój   • U R                  [        R                  [        R                  [        5        g)zI
Pickling a C{lambda} function ought to raise a L{pickle.PicklingError}.
N)r/   r0   r1   rX   ÚlambdaExampler   s    r   Útest_lambdaRaisesPicklingErrorÚ2UnpickleMethodTests.test_lambdaRaisesPicklingError|   s    € ð 	×Ñœ&×.Ñ.´·±¼mÕLr   r   r   )r   r   r   r   r   r=   rA   rD   rH   rY   r]   r   r   r   r   r5   r5   @   s'   † ñô(ô+ô	(ô,ôR÷Mr   r5   r   )r   r@   r0   Útwisted.persisted.stylesr   r   Útwisted.trialr   r   r!   r$   r\   ÚTestCaser)   r5   r   r   r   Ú<module>rb      sb   ðñó Û ç LÝ "÷$ñ $÷ñ ôñ €ôS (×"3Ñ"3ô Sô&@M˜(×+Ñ+õ @Mr   