§
    ÈtºfmJ  ã                   óØ  — d Z ddlZddlZddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZ  G d„ dej        ¦  «        Z G d	„ d
¦  «        Zd„ Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Zd„ Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ dej        ej        ¦  «        Z G d„ dej        ej        ¦  «        Z G d„ d e¦  «        ZdS )!z/
Test cases for L{jelly} object serialization.
é    N)ÚStringTransport)ÚbananaÚjellyÚpb)Úunittest)ÚTestCasec                   ó   — e Zd ZdZdZdd„ZdS )ÚTestNodezD
    An object to test jellyfying of new style class instances.
    é   Nc                 óˆ   — |r*|j         dz   | _         |j                             | ¦  «         nd| _         || _        g | _        d S )Né   )ÚidÚchildrenÚappendÚparent)Úselfr   s     ú]/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/spread/test/test_jelly.pyÚ__init__zTestNode.__init__   sI   € Øð 	Ø”i !‘mˆDŒGØŒO×"Ò" 4Ñ(Ô(Ð(Ð(àˆDŒGØˆŒØˆŒˆˆó    ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	classAttrr   © r   r   r
   r
      s9   € € € € € ðð ð €Iðð ð ð ð ð r   r
   c                   ó   — e Zd ZdZd„ ZdS )ÚAú
    Dummy class.
    c                 ó   — dS ©z;
        Method to be used in serialization tests.
        Nr   ©r   s    r   Úamethodz	A.amethod(   ó   € € € r   N)r   r   r   r   r#   r   r   r   r   r   #   ó-   € € € € € ðð ðð ð ð ð r   r   c                 ó   — dS )z:
    A dummy function to test function serialization.
    Nr   r"   s    r   Úafuncr'   .   r$   r   c                   ó   — e Zd ZdZd„ ZdS )ÚBr   c                 ó   — dS r!   r   r"   s    r   Úbmethodz	B.bmethod9   r$   r   N)r   r   r   r   r+   r   r   r   r)   r)   4   r%   r   r)   c                   ó   — e Zd ZdZd„ ZdS )ÚCr   c                 ó   — dS r!   r   r"   s    r   Úcmethodz	C.cmethodD   r$   r   N)r   r   r   r   r/   r   r   r   r-   r-   ?   r%   r   r-   c                   ó   — e Zd ZdZdS )ÚDz 
    Dummy new-style class.
    N)r   r   r   r   r   r   r   r1   r1   J   s   € € € € € ðð ð ð r   r1   c                   ó*   — e Zd ZdZdZdd„Zd„ Zd„ ZdS )ÚEz+
    Dummy new-style class with slots.
    ©ÚxÚyNc                 ó"   — || _         || _        d S r   r4   ©r   r5   r6   s      r   r   z
E.__init__W   ó   € ØˆŒØˆŒˆˆr   c                 ó    — | j         | j        dœS )Nr4   r4   r"   s    r   Ú__getstate__zE.__getstate__[   s   € Ø”V $¤&Ð)Ð)Ð)r   c                 ó:   — |d         | _         |d         | _        d S )Nr5   r6   r4   ©r   Ústates     r   Ú__setstate__zE.__setstate__^   s   € Ø�s”ˆŒØ�s”ˆŒˆˆr   )NN)r   r   r   r   Ú	__slots__r   r;   r?   r   r   r   r3   r3   P   sW   € € € € € ðð ð €Iðð ð ð ð*ð *ð *ðð ð ð ð r   r3   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚSimpleJellyTestc                 ó"   — || _         || _        d S r   r4   r8   s      r   r   zSimpleJellyTest.__init__d   r9   r   c                 ó"   — | j         |j         k    S r   )Ú__dict__©r   Úothers     r   ÚisTheSameAszSimpleJellyTest.isTheSameAsh   s   € ØŒ} ¤Ò.Ð.r   N)r   r   r   r   rH   r   r   r   rB   rB   c   s2   € € € € € ðð ð ð/ð /ð /ð /ð /r   rB   c                 óÒ   — t          j         |¦  «        }t          j        |¦  «        }t          j        |¦  «        }t          j        |¦  «        }|                      ||¦  «         dS )zt
    Verify that the given object round-trips through jelly & banana and comes
    out equivalent to the input.
    N)r   r   ÚencodeÚdecodeÚunjellyÚassertEqual)ÚtestCaseÚtoSerializeÚjelliedÚencodedÚdecodedÚ	unjellieds         r   ÚjellyRoundTriprT   l   s\   € õ
 Œk˜+Ñ&Ô&€GÝŒm˜GÑ$Ô$€GÝŒm˜GÑ$Ô$€GÝ”˜gÑ&Ô&€IØ×Ò˜ iÑ0Ô0Ð0Ð0Ð0r   c                   óä   — e Zd ZdZdg d¢g d¢g d¢g d¢gZd„ Zd„ Zd	„ Zd
„ Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd „ Zd!„ Zd"„ Z d#„ Z!d$„ Z"d%S )&Ú
JellyTestsz¦
    Testcases for L{jelly} module serialization.

    @cvar decimalData: serialized version of decimal data, to be used in tests.
    @type decimalData: L{list}
    s   list)ó   decimaliã  éþÿÿÿ)rW   r   r   )rW   é@â r   )rW   iËËþÿéýÿÿÿc                 ó2  — t          j         |¦  «        }t          j        ¦   «         }|                     ¦   «          t          j        ||¦  «         |j                             |¦  «         |                      t           j        t           j        ||¦  «         dS )zñ
        Helper test method to test security options for a type.

        @param inputList: a sample input for the type.
        @type inputList: L{list}

        @param atom: atom identifier for the type.
        @type atom: L{str}
        N)r   ÚSecurityOptionsÚallowBasicTypesrL   ÚallowedTypesÚpopÚassertRaisesÚInsecureJelly)r   Ú	inputListÚatomÚcÚtasters        r   Ú_testSecurityzJellyTests._testSecurityˆ   s�   € õ ŒK˜	Ñ"Ô"ˆÝÔ&Ñ(Ô(ˆØ×ÒÑ Ô Ð åŒ�a˜Ñ Ô Ð ØÔ×Ò Ñ%Ô%Ð%à×Ò�%Ô-­u¬}¸aÀÑHÔHÐHÐHÐHr   c                 óR  — t          ¦   «         }t          ¦   «         }t          ¦   «         }|j        |_        ||_        t          j        }t          `	 |                      t          t          j	        t          j        |¦  «        ¦  «         |t          _        dS # |t          _        w xY w)z 
        If a class change after an instance has been created, L{jelly.unjelly}
        shoud raise a C{TypeError} when trying to unjelly the instance.
        N)
r   r)   r-   r/   r+   Úar`   Ú	TypeErrorr   rL   )r   rh   Úbrd   Úsavecmethods        r   Útest_methodsNotSelfIdentityz&JellyTests.test_methodsNotSelfIdentity›   s€   € õ
 ‰CŒCˆÝ‰CŒCˆÝ‰CŒCˆØ”IˆŒ	ØˆŒÝ”iˆÝˆIð	$Ø×Ò�i­¬½¼ÀA¹¼ÑGÔGÐGà#�AŒIˆIˆIø˜�AŒIÐ#Ð#Ð#Ð#s   Á8B ÂB&c                 ód  — t          ¦   «         }d|_        t          ¦   «         }||_        ||_        t	          j        |¦  «        }t	          j        |¦  «        }|                      |t           ¦  «         |                      |j        |j        ¦  «         |                      |j        d¦  «         dS )zƒ
        Test that a new style class can be jellied and unjellied with its
        objects and attribute values preserved.
        r   N)	r1   r5   Ún2Ún3r   rL   ÚassertIsInstanceÚassertIsrM   )r   Únrn   rd   Úms        r   Útest_newStylezJellyTests.test_newStyle¬   s“   € õ
 ‰CŒCˆØˆŒÝ‰SŒSˆØˆŒØˆŒÝŒK˜‰NŒNˆÝŒM˜!ÑÔˆØ×Ò˜a¥Ñ#Ô#Ð#Ø�Š�a”d˜AœDÑ!Ô!Ð!Ø×Ò˜œ˜aÑ Ô Ð Ð Ð r   c                 óì   — t          ¦   «         }d|_        t          j        |¦  «        }t          j        |¦  «        }|                      |t           ¦  «         |                      |j        d¦  «         dS )z‚
        A class defined with I{slots} can be jellied and unjellied with the
        values for its attributes preserved.
        r   N)r3   r5   r   rL   rp   rM   )r   rr   rd   rs   s       r   Útest_newStyleWithSlotsz!JellyTests.test_newStyleWithSlots¼   sd   € õ
 ‰CŒCˆØˆŒÝŒK˜‰NŒNˆÝŒM˜!ÑÔˆØ×Ò˜a¥Ñ#Ô#Ð#Ø×Ò˜œ˜aÑ Ô Ð Ð Ð r   c                 óŽ   — t           g}t          j        t          j        |¦  «        ¦  «        }|                      ||¦  «         dS )zm
        Test that a new style class type can be jellied and unjellied
        to the original type.
        N)r1   r   rL   rM   ©r   ÚtÚrs      r   Útest_typeNewStylezJellyTests.test_typeNewStyleÈ   s>   € õ
 ˆCˆÝŒM�%œ+ a™.œ.Ñ)Ô)ˆØ×Ò˜˜AÑÔÐÐÐr   c                 óŽ   — t           g}t          j        t          j        |¦  «        ¦  «        }|                      ||¦  «         dS )ze
        Test that a builtin type can be jellied and unjellied to the original
        type.
        N)Ústrr   rL   rM   rx   s      r   Útest_typeBuiltinzJellyTests.test_typeBuiltinÑ   s>   € õ
 ˆEˆÝŒM�%œ+ a™.œ.Ñ)Ô)ˆØ×Ò˜˜AÑÔÐÐÐr   c                 ó4  — t           j                              ¦   «         }t           j                              ¦   «         |z
  }||g}t          j        |¦  «        }t          j        |¦  «        }|                      ||¦  «         |                      ||¦  «         dS )z³
        Jellying L{datetime.timedelta} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        N)ÚdatetimeÚnowr   rL   rM   ÚassertIsNot)r   ÚdtnÚdtdrb   rd   Úoutputs         r   Útest_dateTimezJellyTests.test_dateTimeÚ   sŠ   € õ Ô×#Ò#Ñ%Ô%ˆÝÔ×#Ò#Ñ%Ô%¨Ñ+ˆØ˜#�Jˆ	ÝŒK˜	Ñ"Ô"ˆÝ”˜qÑ!Ô!ˆØ×Ò˜ FÑ+Ô+Ð+Ø×Ò˜ FÑ+Ô+Ð+Ð+Ð+r   c                 óR  — t          j        ddd¦  «        }t          j        dddd¦  «        }t           j                              ||¦  «        }|t          j         ddd¦  «        z
  }t	          | |¦  «         t	          | |¦  «         t	          | |¦  «         t	          | |¦  «         d	S )
zÝ
        Jellying L{datetime.time}, L{datetime.timedelta}, L{datetime.datetime},
        and L{datetime.date} objects should result in jellied objects which can
        be serialized and unserialized with banana.
        iä  é   é   r   é   é   iX  é   N)r€   ÚdateÚtimeÚcombinerT   )r   Ú
sampleDateÚ
sampleTimeÚsampleDateTimeÚsampleTimeDeltas        r   Útest_bananaTimeTypeszJellyTests.test_bananaTimeTypesè   s£   € õ ”] 4¨¨BÑ/Ô/ˆ
Ý”] 1 b¨!¨SÑ1Ô1ˆ
Ý!Ô*×2Ò2°:¸zÑJÔJˆØ(­8Ô+<¸TÀ1ÀaÑ+HÔ+HÑHˆÝ�t˜ZÑ(Ô(Ð(Ý�t˜ZÑ(Ô(Ð(Ý�t˜^Ñ,Ô,Ð,Ý�t˜_Ñ-Ô-Ð-Ð-Ð-r   c                 óJ  — t          j        d¦  «        t          j        d¦  «        t          j        d¦  «        t          j        d¦  «        g}t          j        |¦  «        }t          j        |¦  «        }|                      ||¦  «         |                      ||¦  «         dS )z°
        Jellying L{decimal.Decimal} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        ú9.95r   rY   ú-78.901N)ÚdecimalÚDecimalr   rL   rM   r‚   )r   rb   rd   r…   s       r   Útest_decimalzJellyTests.test_decimal÷   s‘   € õ ŒO˜FÑ#Ô#ÝŒO˜AÑÔÝŒO˜FÑ#Ô#ÝŒO˜IÑ&Ô&ð	
ˆ	õ ŒK˜	Ñ"Ô"ˆÝ”˜qÑ!Ô!ˆØ×Ò˜ FÑ+Ô+Ð+Ø×Ò˜ FÑ+Ô+Ð+Ð+Ð+r   c                 ó   — t          j        d¦  «        t          j        d¦  «        t          j        d¦  «        t          j        d¦  «        g}t          j        | j        ¦  «        }|                      ||¦  «         dS )a  
        Unjellying the s-expressions produced by jelly for L{decimal.Decimal}
        instances should result in L{decimal.Decimal} instances with the values
        represented by the s-expressions.

        This test also verifies that L{decimalData} contains valid jellied
        data.  This is important since L{test_decimalMissing} re-uses
        L{decimalData} and is expected to be unable to produce
        L{decimal.Decimal} instances even though the s-expression correctly
        represents a list of them.
        r–   r   rY   r—   N)r˜   r™   r   rL   ÚdecimalDatarM   )r   Úexpectedr…   s      r   Útest_decimalUnjellyzJellyTests.test_decimalUnjelly  so   € õ ŒO˜FÑ#Ô#ÝŒO˜AÑÔÝŒO˜FÑ#Ô#ÝŒO˜IÑ&Ô&ð	
ˆõ ”˜tÔ/Ñ0Ô0ˆØ×Ò˜ Ñ*Ô*Ð*Ð*Ð*r   c                 ó\   — t          j        d¦  «        g}|                      |d¦  «         dS )zÏ
        By default, C{decimal} objects should be allowed by
        L{jelly.SecurityOptions}. If not allowed, L{jelly.unjelly} should raise
        L{jelly.InsecureJelly} when trying to unjelly it.
        r–   rW   N)r˜   r™   rf   ©r   rb   s     r   Útest_decimalSecurityzJellyTests.test_decimalSecurity  s2   € õ ”_ VÑ,Ô,Ð-ˆ	Ø×Ò˜9 jÑ1Ô1Ð1Ð1Ð1r   c                 ó´   — h d£g}t          j        t          j         |¦  «        ¦  «        }|                      ||¦  «         |                      ||¦  «         dS )z¤
        Jellying C{set} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        ¾   r   é   rŒ   N)r   rL   rM   r‚   ©r   rb   r…   s      r   Útest_setzJellyTests.test_set&  sZ   € ð �Y�Y�Kˆ	Ý”�uœ{¨9Ñ5Ô5Ñ6Ô6ˆØ×Ò˜ FÑ+Ô+Ð+Ø×Ò˜ FÑ+Ô+Ð+Ð+Ð+r   c                 óÎ   — t          g d¢¦  «        g}t          j        t          j        |¦  «        ¦  «        }|                      ||¦  «         |                      ||¦  «         dS )zª
        Jellying L{frozenset} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        ©r   r¤   rŒ   N)Ú	frozensetr   rL   rM   r‚   r¥   s      r   Útest_frozensetzJellyTests.test_frozenset1  sc   € õ ˜y˜y˜yÑ)Ô)Ð*ˆ	Ý”�uœ{¨9Ñ5Ô5Ñ6Ô6ˆØ×Ò˜ FÑ+Ô+Ð+Ø×Ò˜ FÑ+Ô+Ð+Ð+Ð+r   c                 ó<   — h d£g}|                       |d¦  «         dS )zË
        By default, C{set} objects should be allowed by
        L{jelly.SecurityOptions}. If not allowed, L{jelly.unjelly} should raise
        L{jelly.InsecureJelly} when trying to unjelly it.
        r£   s   setN)rf   r    s     r   Útest_setSecurityzJellyTests.test_setSecurity<  s+   € ð �Y�Y�Kˆ	Ø×Ò˜9 fÑ-Ô-Ð-Ð-Ð-r   c                 óV   — t          g d¢¦  «        g}|                      |d¦  «         dS )zÑ
        By default, L{frozenset} objects should be allowed by
        L{jelly.SecurityOptions}. If not allowed, L{jelly.unjelly} should raise
        L{jelly.InsecureJelly} when trying to unjelly it.
        r¨   s	   frozensetN)r©   rf   r    s     r   Útest_frozensetSecurityz!JellyTests.test_frozensetSecurityE  s4   € õ ˜y˜y˜yÑ)Ô)Ð*ˆ	Ø×Ò˜9 lÑ3Ô3Ð3Ð3Ð3r   c                 óN  — |                       t          dd¦  «                             t          dd¦  «        ¦  «        ¦  «         t          dd¦  «        }t          j        |¦  «        }t          j        |¦  «        }|                       |                     |¦  «        ¦  «         dS )z%
        Simplest test case.
        rh   rj   r   r¤   N)Ú
assertTruerB   rH   r   rL   )r   rh   Úcerealrj   s       r   Útest_simplezJellyTests.test_simpleN  s�   € ð 	�ŠÝ˜C Ñ%Ô%×1Ò1µ/À#ÀsÑ2KÔ2KÑLÔLñ	
ô 	
ð 	
õ ˜A˜qÑ!Ô!ˆÝ”˜Q‘”ˆÝŒM˜&Ñ!Ô!ˆØ�Š˜Ÿš aÑ(Ô(Ñ)Ô)Ð)Ð)Ð)r   c                 óÂ  — g }|}|                      |¦  «         |                      |¦  «         |                      |d         |d         ¦  «         |                      |d         d         |¦  «         t          j        |¦  «        }t          j        |¦  «        }|                      |d         |d         ¦  «         |                      |d         d         |¦  «         dS )zJ
        Test to make sure that objects retain identity properly.
        r   r   N)r   rq   r   rL   )r   r5   r6   ÚsÚzs        r   Útest_identityzJellyTests.test_identityZ  s¾   € ð ˆØˆØ	�Š�‰ŒˆØ	�Š�‰ŒˆØ�Š�a˜”d˜A˜aœDÑ!Ô!Ð!Ø�Š�a˜”d˜1”g˜qÑ!Ô!Ð!ÝŒK˜‰NŒNˆÝŒM˜!ÑÔˆØ�Š�a˜”d˜A˜aœDÑ!Ô!Ð!Ø�Š�a˜”d˜1”g˜qÑ!Ô!Ð!Ð!Ð!r   c                 óâ   — d}t          j        t          j         |¦  «        ¦  «        }|                      ||¦  «         |                      t          |¦  «        t          |¦  «        ¦  «         d S )NÚblah)r   rL   rM   Útyper8   s      r   Útest_strzJellyTests.test_stri  s\   € ØˆÝŒM�%œ+ a™.œ.Ñ)Ô)ˆØ×Ò˜˜AÑÔÐØ×Ò�˜a™œ¥$ q¡'¤'Ñ*Ô*Ð*Ð*Ð*r   c                 ó0  — g }d|i|f}|                      |¦  «         t          j        |¦  «        }t          j        |¦  «        }|                      |d         d         |d         ¦  «         |                      |d         d         d         |¦  «         d S )NÚlistr   r   ©r   r   rL   rq   )r   ÚrerefÚtoplevelTupler´   rµ   s        r   Útest_stressReferencesz JellyTests.test_stressReferenceso  s‹   € ØˆØ  %˜¨%Ð0ˆØ�Š�]Ñ#Ô#Ð#ÝŒK˜Ñ&Ô&ˆÝŒM˜!ÑÔˆØ�Š�a˜”d˜6”l A a¤DÑ)Ô)Ð)Ø�Š�a˜”d˜6”l 1”o qÑ)Ô)Ð)Ð)Ð)r   c                 óÜ   — g }|f}|                      |f¦  «         t          j        |¦  «        }t          j        |¦  «        }|                      |d         d         d         |¦  «         d S ©Nr   r½   )r   rh   ry   r´   rµ   s        r   Útest_moreReferenceszJellyTests.test_moreReferencesx  sa   € ØˆØˆDˆØ	�Š�!�‰ŒˆÝŒK˜‰NŒNˆÝŒM˜!ÑÔˆØ�Š�a˜”d˜1”g˜a”j !Ñ$Ô$Ð$Ð$Ð$r   c                 ó¬   — t          j        ¦   «         }t          j         i ¦  «        }|                      t           j        t           j        ||¦  «         dS )z@
        Test for type-level security of serialization.
        N)r   r\   r`   ra   rL   )r   re   Údcts      r   Útest_typeSecurityzJellyTests.test_typeSecurity€  sD   € õ Ô&Ñ(Ô(ˆÝŒk˜"‰oŒoˆØ×Ò�%Ô-­u¬}¸cÀ6ÑJÔJÐJÐJÐJr   c                 ón   — t          j        t          ¦  «        }|                      t          |¦  «         d S r   )r   rL   r1   rq   )r   Úujs     r   Útest_newStyleClasseszJellyTests.test_newStyleClassesˆ  s+   € ÝŒ]�1ÑÔˆØ�Š•a˜ÑÔÐÐÐr   c                 óÎ  — t          ¦   «         }t          j        t          j        |¦  «        ¦  «         t          j        t          j        |j        ¦  «        ¦  «         t          g d¢t          d¦  «         t          d¦  «        ddddt           t          ddit           j        g}|D ]<}|                      |t          j        t          j        |¦  «        ¦  «        ¦  «         Œ=dS )zA
        Test for all types currently supported in jelly
        r¨   r   ÚtestgÍÌÌÌÌL4@Nrh   )r   r   rL   r#   r'   Úboolr   rM   )r   rh   ÚitemsÚis       r   Útest_lotsaTypeszJellyTests.test_lotsaTypesŒ  sÊ   € õ ‰CŒCˆÝŒ•e”k !‘n”nÑ%Ô%Ð%ÝŒ•e”k !¤)Ñ,Ô,Ñ-Ô-Ð-åØˆIˆIÝ�Q‘”ˆKÝ�‰GŒGØØØØÝÝØ�!ˆHÝŒIð
ˆð ð 	?ð 	?ˆAØ×Ò˜Q¥¤­e¬k¸!©n¬nÑ =Ô =Ñ>Ô>Ð>Ð>ð	?ð 	?r   c                 ór  —  G d„ d¦  «        a t          ¦   «         }t          |¦  «        }t          |¦  «        }t          ||f¦  «        }||||||d|i}t          j        t          j        |¦  «        ¦  «        d         }|                      |j        d         j        |j        d         j        ¦  «         d S )Nc                   ó&   — e Zd Zd„ Zd„ Zd„ Zd„ ZdS )Ú
TupleStatec                 ó   — || _         d S r   ©rG   rF   s     r   r   zTupleState.__init__¨  s   € Ø"�”
�
�
r   c                 ó   — | j         fS r   rÔ   r"   s    r   r;   zTupleState.__getstate__«  s   € Øœ
�}Ð$r   c                 ó    — |d         | _         d S rÂ   rÔ   r=   s     r   r?   zTupleState.__setstate__®  s   € Ø" 1œX�”
�
�
r   c                 ó*   — t          | j        ¦  «        S r   )ÚhashrG   r"   s    r   Ú__hash__zTupleState.__hash__±  s   € Ý˜DœJÑ'Ô'Ð'r   N)r   r   r   r   r;   r?   rÙ   r   r   r   rÒ   rÒ   §  sP   € € € € € ð#ð #ð #ð%ð %ð %ð&ð &ð &ð(ð (ð (ð (ð (r   rÒ   Út3r   r   )rÒ   r   r   rL   rq   rG   )r   rh   Út1Út2rÚ   ÚdÚt3primes          r   Útest_setStatezJellyTests.test_setState¤  s¼   € ð	(ð 	(ð 	(ð 	(ð 	(ñ 	(ô 	(ð 	(õ ‰CŒCˆÝ˜‰]Œ]ˆÝ˜‰]Œ]ˆÝ˜˜R˜Ñ!Ô!ˆØ��R˜˜R  T¨2Ð.ˆÝ”-¥¤¨A¡¤Ñ/Ô/°Ô5ˆØ�Š�g”m AÔ&Ô,¨g¬m¸AÔ.>Ô.DÑEÔEÐEÐEÐEr   c                 óô  — t          j        ¦   «         }|                     t          t          ¦  «         t          ¦   «         }t	          ¦   «         }t          ¦   «         }||_        ||_        ||_        ||_        t          j         ||¦  «        }t          j	        ||¦  «        }|  
                    |j        t           j        ¦  «         t          j         |¦  «        }|                      t           j        t           j	        ||¦  «         |                      |j        |j        d¦  «         t          j         t          |¦  «        }t          j	        ||¦  «        }|                      |t          d|z  ¦  «         dS )zA
        Test for class-level security of serialization.
        zIdentity mismatchzA came back: %sN)r   r\   ÚallowInstancesOfr   r)   r-   rj   rd   r5   rL   rp   ÚUnpersistabler`   ra   rq   )r   re   rh   rj   rd   Úfriendlyr5   Úmeans           r   Útest_classSecurityzJellyTests.test_classSecurity¼  s'  € õ Ô&Ñ(Ô(ˆØ×Ò¥¥1Ñ%Ô%Ð%Ý‰CŒCˆÝ‰CŒCˆÝ‰CŒCˆàˆŒØˆŒàˆŒØˆŒå”;˜q &Ñ)Ô)ˆÝŒM˜( FÑ+Ô+ˆØ×Ò˜aœc¥5Ô#6Ñ7Ô7Ð7åŒ{˜1‰~Œ~ˆØ×Ò�%Ô-­u¬}¸dÀFÑKÔKÐKØ�Š�a”c˜1œ3Ð 3Ñ4Ô4Ð4å”;�q &Ñ)Ô)ˆÝŒM˜( FÑ+Ô+ˆØ�Š�a�Ð-°Ñ1Ñ2Ô2Ð2Ð2Ð2r   c                 óX  —  G d„ dt           j        ¦  «        }t          j        |t           j        ¦  «          |¦   «         }d|_        t          j        t          j         |¦  «        ¦  «        }|                      |j        d¦  «         |                      |t           j        ¦  «         dS )zr
        Test that if Unjellyable is used to deserialize a jellied object,
        state comes out right.
        c                   ó   — e Zd ZdS )ú7JellyTests.test_unjellyable.<locals>.JellyableTestClassN©r   r   r   r   r   r   ÚJellyableTestClassrè   Þ  ó   € € € € € ØˆDr   rê   ÚvalueN)r   Ú	JellyableÚsetUnjellyableForClassÚUnjellyableÚ	attributerL   rM   rp   )r   rê   Úinputr…   s       r   Útest_unjellyablezJellyTests.test_unjellyableØ  s­   € ð	ð 	ð 	ð 	ð 	¥¤ñ 	ô 	ð 	õ 	Ô$Ð%7½Ô9JÑKÔKÐKØ"Ð"Ñ$Ô$ˆØ!ˆŒÝ”�uœ{¨5Ñ1Ô1Ñ2Ô2ˆØ×Ò˜Ô)¨7Ñ3Ô3Ð3Ø×Ò˜f¥eÔ&7Ñ8Ô8Ð8Ð8Ð8r   c                 óÈ  — i dg}|fd„}|fd„}t          dd¦  «        }t          dd¦  «        }t          dd¦  «        }||_        ||_        ||_        t          j        ||¬	¦  «        }t          j        ||¬
¦  «        }|                      |j        |j        j        ¦  «         |                      |d         d¦  «         |                      |j        |j        d¦  «         d S )Nr   c                 ój   — |d         dz   |d<   | |d         |d         <   t          |d         ¦  «        S )Nr   r   )r}   )ÚobjÚjelÚpersts      r   ÚpersistentStorez:JellyTests.test_persistentStorage.<locals>.persistentStoreë  s5   € Ø˜Q”x !‘|ˆE�!‰HØ!$ˆE�!ŒH�U˜1”XÑÝ�u˜Q”x‘=”=Ð r   c                 ó<   — t          | ¦  «        }|d         |         S rÂ   )Úint)ÚpidstrÚunjr÷   Úpids       r   ÚpersistentLoadz9JellyTests.test_persistentStorage.<locals>.persistentLoadð  s   € Ý�f‘+”+ˆCØ˜”8˜C”=Ð r   r¤   rŒ   r   r‹   é   )rø   )rþ   r   zpersistentStore was not called.z$Persistent storage identity failure.)rB   rj   rd   r   rL   rq   r°   )	r   r÷   rø   rþ   rh   rj   rd   rö   r5   s	            r   Útest_persistentStoragez!JellyTests.test_persistentStorageè  sû   € Ø�Q�ˆà,1ð 	!ð 	!ð 	!ð 	!ð
 /4ð 	!ð 	!ð 	!ð 	!õ ˜A˜qÑ!Ô!ˆÝ˜A˜qÑ!Ô!ˆÝ˜A˜qÑ!Ô!ˆàˆŒØˆŒØˆŒåŒk˜!¨_Ð=Ñ=Ô=ˆÝŒM˜#¨nÐ=Ñ=Ô=ˆà�Š�a”c˜1œ3œ5Ñ!Ô!Ð!Ø�Š˜˜aœÐ"CÑDÔDÐDØ�Š�a”c˜1œ3Ð FÑGÔGÐGÐGÐGr   c                 óø   — t          ¦   «         }t          |¦  «        }t          |¦  «         t          |¦  «         t          j        |¦  «        }t          j        |¦  «        }|                      ||¦  «         d S r   )r
   r   rL   Ú_check_newstyle)r   rr   Ún1rö   rs   s        r   Útest_newStyleClassesAttributesz)JellyTests.test_newStyleClassesAttributes  sd   € Ý‰JŒJˆÝ�a‰[Œ[ˆÝ�‰ŒˆÝ�‰ŒˆåŒk˜!‰nŒnˆÝŒM˜#ÑÔˆà×Ò˜Q Ñ"Ô"Ð"Ð"Ð"r   c                 ó’  — |                       |j        |j        ¦  «         |                       |j        d¦  «         |                       |j        d¦  «         |                       t          |j        ¦  «        t          |j        ¦  «        ¦  «         t          |j        |j        ¦  «        D ]\  }}|                      ||¦  «         Œd S )Nr   )rM   r   r   Úlenr   Úzipr  )r   rh   rj   r5   r6   s        r   r  zJellyTests._check_newstyle  s¶   € Ø×Ò˜œ˜qœtÑ$Ô$Ð$Ø×Ò˜œ aÑ(Ô(Ð(Ø×Ò˜œ aÑ(Ô(Ð(Ø×Ò�˜QœZ™œ­#¨a¬j©/¬/Ñ:Ô:Ð:Ý˜œ
 A¤JÑ/Ô/ð 	'ð 	'‰DˆAˆqØ× Ò   AÑ&Ô&Ð&Ð&ð	'ð 	'r   c                 ó”  — t          j        ¦   «         }t          j        ¦   «         }|                     t	          ¦   «         ¦  «         t          j        ||¬¦  «        }t          j        ¦   «         }|                     t	          ¦   «         ¦  «         t          j        ||¬¦  «        }|                      |j        |j	        ¦  «         dS )a  
        A L{pb.Referenceable} instance jellies to a structure which unjellies to
        a L{pb.RemoteReference}.  The C{RemoteReference} has a I{luid} that
        matches up with the local object key in the L{pb.Broker} which sent the
        L{Referenceable}.
        ©ÚinvokerN)
r   ÚReferenceableÚBrokerÚmakeConnectionr   r   rL   ÚassertInÚluidÚlocalObjects)r   ÚrefÚjellyBrokerÚjÚunjellyBrokerrÈ   s         r   Útest_referenceablezJellyTests.test_referenceable  s£   € õ ÔÑ Ô ˆÝ”i‘k”kˆØ×"Ò"¥?Ñ#4Ô#4Ñ5Ô5Ð5ÝŒK˜ [Ð1Ñ1Ô1ˆåœ	™œˆØ×$Ò$¥_Ñ%6Ô%6Ñ7Ô7Ð7åŒ]˜1 mÐ4Ñ4Ô4ˆØ�Š�b”g˜{Ô7Ñ8Ô8Ð8Ð8Ð8r   N)#r   r   r   r   rœ   rf   rl   rt   rv   r{   r~   r†   r”   rš   rž   r¡   r¦   rª   r¬   r®   r²   r¶   rº   rÀ   rÃ   rÆ   rÉ   rÏ   rß   rå   rò   r   r  r  r  r   r   r   rV   rV   x   s  € € € € € ðð ð 	ØÐÐØÐÐØÐÐØ Ð Ð ð€KðIð Ið Ið&$ð $ð $ð"!ð !ð !ð 
!ð 
!ð 
!ðð ð ðð ð ð,ð ,ð ,ð.ð .ð .ð,ð ,ð ,ð"+ð +ð +ð*2ð 2ð 2ð	,ð 	,ð 	,ð	,ð 	,ð 	,ð.ð .ð .ð4ð 4ð 4ð
*ð 
*ð 
*ð"ð "ð "ð+ð +ð +ð*ð *ð *ð%ð %ð %ðKð Kð Kðð ð ð?ð ?ð ?ð0Fð Fð Fð03ð 3ð 3ð89ð 9ð 9ð Hð Hð Hð6	#ð 	#ð 	#ð'ð 'ð 'ð9ð 9ð 9ð 9ð 9r   rV   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚJellyDeprecationTestsz+
    Tests for deprecated Jelly things
    c                 ó,  — t           j         |                      | j        g¦  «        }|                      t          |¦  «        d¦  «         |                      |d         d         d¦  «         |                      |d         d         t          ¦  «         dS )zD
        L{jelly.instance_atom} is deprecated since 15.0.0.
        r   r   Úmessagezltwisted.spread.jelly.instance_atom was deprecated in Twisted 15.0.0: instance_atom is unused within Twisted.ÚcategoryN)r   Úinstance_atomÚflushWarningsÚtest_deprecatedInstanceAtomrM   r  ÚDeprecationWarning©r   Úwarningss     r   r  z1JellyDeprecationTests.test_deprecatedInstanceAtom.  s“   € õ 	ÔÐØ×%Ò% tÔ'GÐ&HÑIÔIˆØ×Ò�˜X™œ¨Ñ*Ô*Ð*Ø×ÒØ�QŒK˜	Ô"ð>ñ	
ô 	
ð 	
ð
 	×Ò˜ !œ ZÔ0Õ2DÑEÔEÐEÐEÐEr   c                 ó:  — t          j        dddgdgg¦  «         |                      ¦   «         }|                      t	          |¦  «        d¦  «         |                      |d         d         d¦  «         |                      |d         d	         t
          ¦  «         d
S )zI
        Unjellying the instance atom is deprecated with 15.0.0.
        ÚinstanceÚclassz twisted.spread.test.test_jelly.AÚ
dictionaryr   r   r  ztUnjelly support for the instance atom is deprecated since Twisted 15.0.0.  Upgrade peer for modern instance support.r  N)r   rL   r  rM   r  r  r  s     r   Ú%test_deprecatedUnjellyingInstanceAtomz;JellyDeprecationTests.test_deprecatedUnjellyingInstanceAtom<  s«   € õ 	ŒØ˜'Ð#EÐFÈÈÐWñ	
ô 	
ð 	
ð ×%Ò%Ñ'Ô'ˆØ×Ò�˜X™œ¨Ñ*Ô*Ð*Ø×ÒØ�QŒK˜	Ô"ðIñ	
ô 	
ð 	
ð
 	×Ò˜ !œ ZÔ0Õ2DÑEÔEÐEÐEÐEr   N)r   r   r   r   r  r%  r   r   r   r  r  )  sD   € € € € € ðð ðFð Fð FðFð Fð Fð Fð Fr   r  c                   ó   — e Zd Zd„ ZdS )ÚClassAc                 ó.   — t          | ¦  «        | _        d S r   )ÚClassBr  r"   s    r   r   zClassA.__init__N  s   € Ý˜$‘<”<ˆŒˆˆr   N©r   r   r   r   r   r   r   r'  r'  M  s#   € € € € € ð ð  ð  ð  ð  r   r'  c                   ó   — e Zd Zd„ ZdS )r)  c                 ó   — || _         d S r   )r  )r   r  s     r   r   zClassB.__init__S  s   € ØˆŒˆˆr   Nr*  r   r   r   r)  r)  R  s#   € € € € € ðð ð ð ð r   r)  c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚCircularReferenceTestszN
    Tests for circular references handling in the jelly/unjelly process.
    c                 ó(  — t          j        t          t          ¦  «         t          j        t          t          ¦  «         t          j        t          j         t          ¦   «         ¦  «        ¦  «        }|                      |j        j        |d¦  «         d S )Nú,Identity not preserved in circular reference)r   rî   r'  r)  rL   rq   r  )r   rh   s     r   Útest_simpleCirclez(CircularReferenceTests.test_simpleCircle\  sf   € ÝÔ$¥V­VÑ4Ô4Ð4ÝÔ$¥V­VÑ4Ô4Ð4ÝŒM�%œ+¥f¡h¤hÑ/Ô/Ñ0Ô0ˆØ�Š�a”e”i Ð$RÑSÔSÐSÐSÐSr   c                 óp  —  G d„ d¦  «        } |¦   «         }d |_         t          ¦   «         }t          j        t          t          ¦  «         t          j        t          t          ¦  «         t          j        ||¬¦  «        }t          j        |¦  «        }|                      |j        j        |d¦  «         d S )Nc                   ó   — e Zd ZdS )úHCircularReferenceTests.test_circleWithInvoker.<locals>.DummyInvokerClassNré   r   r   r   ÚDummyInvokerClassr4  c  rë   r   r5  r	  r0  )ÚserializingPerspectiver'  r   rî   r)  rL   ÚfailUnlessIdenticalr  )r   r5  ÚdummyInvokerÚa0r  Úa1s         r   Útest_circleWithInvokerz-CircularReferenceTests.test_circleWithInvokerb  sÂ   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð )Ð(Ñ*Ô*ˆØ.2ˆÔ+Ý‰XŒXˆÝÔ$¥V­VÑ4Ô4Ð4ÝÔ$¥V­VÑ4Ô4Ð4ÝŒK˜ LÐ1Ñ1Ô1ˆÝŒ]˜1ÑÔˆØ× Ò ØŒFŒJ˜ÐJñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óJ  — t          ¦   «         }t          |d¦  «        }|                     |¦  «         t          j        t          j        |¦  «        ¦  «        }|                      |j        t           ¦  «         |                      t          |j        ¦  «        |g¦  «         dS )z�
        Check that a C{set} can contain a circular reference and be serialized
        and unserialized without losing the reference.
        N)	ÚsetrB   Úaddr   rL   rp   r5   rM   r¼   )r   r´   rh   Úress       r   r¦   zCircularReferenceTests.test_setq  s€   € õ
 ‰EŒEˆÝ˜A˜tÑ$Ô$ˆØ	�Šˆa‰ŒˆÝŒm�EœK¨™NœNÑ+Ô+ˆØ×Ò˜cœe¥SÑ)Ô)Ð)Ø×Ò�˜cœe™œ s eÑ,Ô,Ð,Ð,Ð,r   c                 ó2  — t          dd¦  «        }t          |g¦  «        }||_        t          j        t          j        |¦  «        ¦  «        }|                      |j        t          ¦  «         |                      t          |j        ¦  «        |g¦  «         dS )z•
        Check that a L{frozenset} can contain a circular reference and be
        serialized and unserialized without losing the reference.
        N)rB   r©   r5   r   rL   rp   rM   r¼   )r   rh   r´   r?  s       r   rª   z%CircularReferenceTests.test_frozenset}  s|   € õ
 ˜D $Ñ'Ô'ˆÝ�q�c‰NŒNˆØˆŒÝŒm�EœK¨™NœNÑ+Ô+ˆØ×Ò˜cœe¥YÑ/Ô/Ð/Ø×Ò�˜cœe™œ s eÑ,Ô,Ð,Ð,Ð,r   N)r   r   r   r   r1  r;  r¦   rª   r   r   r   r.  r.  W  s]   € € € € € ðð ðTð Tð Tð
ð 
ð 
ð
-ð 
-ð 
-ð
-ð 
-ð 
-ð 
-ð 
-r   r.  )r   r€   r˜   Útwisted.internet.testingr   Útwisted.spreadr   r   r   Útwisted.trialr   Útwisted.trial.unittestr   rí   r
   r   r'   r)   r-   r1   r3   rB   rT   rV   r  ÚCopyableÚ
RemoteCopyr'  r)  r.  r   r   r   ú<module>rG     s«  ððð ð
 €€€Ø €€€à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø "Ð "Ð "Ð "Ð "Ð "Ø +Ð +Ð +Ð +Ð +Ð +ðð ð ð ð ˆuŒñ ô ð ð"ð ð ð ð ñ ô ð ðð ð ðð ð ð ð ñ ô ð ðð ð ð ð ñ ô ð ðð ð ð ð ñ ô ð ðð ð ð ð ñ ô ð ð&/ð /ð /ð /ð /ñ /ô /ð /ð	1ð 	1ð 	1ðn9ð n9ð n9ð n9ð n9�ñ n9ô n9ð n9ðb!Fð !Fð !Fð !Fð !F˜Hñ !Fô !Fð !FðH ð  ð  ð  ð  ˆRŒ[˜"œ-ñ  ô  ð  ð
ð ð ð ð ˆRŒ[˜"œ-ñ ô ð ð
0-ð 0-ð 0-ð 0-ð 0-˜Xñ 0-ô 0-ð 0-ð 0-ð 0-r   