
~Mc           @   s  d  Z  d d l Z y d d l Z Wn e k
 r; e Z n Xd d l m Z m Z d d l m	 Z	 m
 Z
 d d l m Z d d l m Z d e e j f d     YZ d	 f  d
     YZ d   Z d f  d     YZ d f  d     YZ d e f d     YZ d e f d     YZ d f  d     YZ d e j f d     YZ d e j e j f d     YZ d e j e j f d     YZ d e j f d     YZ d S(   s/   
Test cases for L{jelly} object serialization.
iN(   t   jellyt   pb(   t   sett	   frozenset(   t   unittest(   t   StringTransportt   TestNodec           B   s    e  Z d  Z d Z d d  Z RS(   sD   
    An object to test jellyfying of new style class instances.
    i   c         C   sH   | r) | j  d |  _  | j j |   n	 d |  _  | |  _ g  |  _ d  S(   Ni   (   t   idt   childrent   appendt   parent(   t   selfR
   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   __init__   s    		N(   t   __name__t
   __module__t   __doc__t	   classAttrt   NoneR   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR      s   t   Ac           B   s   e  Z d  Z d   Z RS(   s   
    Dummy class.
    c         C   s   d S(   s;   
        Method tp be used in serialization tests.
        N(    (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   amethod+   s    (   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   &   s   c         C   s   d S(   s:   
    A dummy function to test function serialization.
    N(    (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   afunc2   s    t   Bc           B   s   e  Z d  Z d   Z RS(   s   
    Dummy class.
    c         C   s   d S(   s;   
        Method to be used in serialization tests.
        N(    (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   bmethod>   s    (   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   9   s   t   Cc           B   s   e  Z d  Z d   Z RS(   s   
    Dummy class.
    c         C   s   d S(   s;   
        Method to be used in serialization tests.
        N(    (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   cmethodJ   s    (   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   E   s   t   Dc           B   s   e  Z d  Z RS(   s    
    Dummy new-style class.
    (   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   Q   s   t   Ec           B   s5   e  Z d  Z d Z d d d  Z d   Z d   Z RS(   s+   
    Dummy new-style class with slots.
    t   xt   yc         C   s   | |  _  | |  _ d  S(   N(   R   R   (   R   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   _   s    	c         C   s   i |  j  d 6|  j d 6S(   NR   R   (   R   R   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   __getstate__d   s    c         C   s   | d |  _  | d |  _ d  S(   NR   R   (   R   R   (   R   t   state(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   __setstate__h   s    (   R   R   N(   R   R   R   t	   __slots__R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   X   s
   	t   SimpleJellyTestc           B   s   e  Z d    Z d   Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   R   R   (   R   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   o   s    	c         C   s   |  j  | j  k S(   N(   t   __dict__(   R   t   other(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   isTheSameAss   s    (   R   R   R   R$   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR!   n   s   	t   JellyTestCasec           B   s  e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d d d d g d d d g d d d g d d d g g Z d   Z d   Z d   Z e d, k r d Z e e _ e e _ e e _ n  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) RS(-   s   
    Testcases for L{jelly} module serialization.

    @cvar decimalData: serialized version of decimal data, to be used in tests.
    @type decimalData: C{list}
    c         C   se   t  j  |  } t  j   } | j   t  j | |  | j j |  |  j t  j t  j | |  d S(   s   
        Helper test method to test security options for a type.

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

        @param atom: atom identifier for the type.
        @type atom: C{str}
        N(   R    t   SecurityOptionst   allowBasicTypest   unjellyt   allowedTypest   popt   assertRaisest   InsecureJelly(   R   t	   inputListt   atomt   ct   taster(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   _testSecurity   s    

c         C   sb   t    } t   } | j | _ | | _ t j t j |   j j } |  j | j | j j	  d  S(   N(
   R   R   R   t   aR    R(   t   assertEqualst   im_classt   im_selft	   __class__(   R   R2   t   bt   im_(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_methodSelfIdentity   s    			c         C   ss   t    } t   } t   } | j | _ | | _ t j } t ` z# |  j t t j	 t j |   Wd | t _ Xd S(   s   
        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   R2   R+   t	   TypeErrorR    R(   (   R   R2   R7   R/   t   savecmethod(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_methodsNotSelfIdentity   s    					#c         C   su   t    } d | _ t    } | | _ | | _ t j |  } t j |  } |  j | t   |  j | j | j  d  S(   Ni   (   R   R   t   n2t   n3R    R(   t   assertIsInstancet   assertIdentical(   R   t   nR=   R/   t   m(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_newStyle   s    					c         C   sW   t    } d | _ t j |  } t j |  } |  j | t   |  j | j d  d S(   s   
        A class defined with I{slots} can be jellied and unjellied with the
        values for its attributes preserved.
        i   N(   R   R   R    R(   R?   R3   (   R   RA   R/   RB   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_newStyleWithSlots   s    		c         C   s5   t  g } t j t j |   } |  j | |  d S(   sn   
        Test that an old style class type can be jellied and unjellied
        to the original type.
        N(   R   R    R(   R3   (   R   t   tt   r(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_typeOldStyle   s    	c         C   s5   t  g } t j t j |   } |  j | |  d S(   sm   
        Test that a new style class type can be jellied and unjellied
        to the original type.
        N(   R   R    R(   R3   (   R   RE   RF   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_typeNewStyle   s    	c         C   s5   t  g } t j t j |   } |  j | |  d S(   se   
        Test that a builtin type can be jellied and unjellied to the original
        type.
        N(   t   strR    R(   R3   (   R   RE   RF   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_typeBuiltin   s    	c         C   sp   t  j  j   } t  j  j   | } | | g } t j |  } t j |  } |  j | |  |  j | |  d  S(   N(   t   datetimet   nowR    R(   R3   t   assertNotIdentical(   R   t   dtnt   dtdt   inputR/   t   output(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_dateTime   s    c         C   sx   t  j d  t  j d  t  j d  t  j d  g } t j |  } t j |  } |  j | |  |  j | |  d S(   s   
        Jellying L{decimal.Decimal} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        s   9.95i    i@ s   -78.901N(   t   decimalt   DecimalR    R(   R3   RM   (   R   R-   R/   RQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_decimal   s    t   listRS   i  ii    i@ iic         C   s\   t  j d  t  j d  t  j d  t  j d  g } t j |  j  } |  j | |  d S(   s  
        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 C{self.decimalData} contains valid jellied
        data.  This is important since L{test_decimalMissing} re-uses
        C{self.decimalData} and is expected to be unable to produce
        L{decimal.Decimal} instances even though the s-expression correctly
        represents a list of them.
        s   9.95i    i@ s   -78.901N(   RS   RT   R    R(   t   decimalDataR3   (   R   t   expectedRQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_decimalUnjelly  s    c         C   s   |  j  t d d  t j |  j  } |  j t |  d  x+ t d  D] } |  j | | t j	  qH W|  j | d j
 d  |  j | d j
 d  |  j | d j
 d  |  j | d	 j
 d
  d S(   s   
        If decimal is unavailable on the unjelly side, L{jelly.unjelly} should
        gracefully return L{jelly.Unpersistable} objects.
        RS   i   i    s!   Could not unpersist decimal: 9.95i   s   Could not unpersist decimal: 0i   s#   Could not unpersist decimal: 123456i   s$   Could not unpersist decimal: -78.901N(   t   patchR    R   R(   RW   R3   t   lent   rangeR?   t   Unpersistablet   reason(   R   RQ   t   i(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_decimalMissing  s    c         C   s&   t  j d  g } |  j | d  d S(   s   
        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.
        s   9.95RS   N(   RS   RT   R1   (   R   R-   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_decimalSecurity,  s    s   decimal not availablec         C   sT   t  d d d g  g } t j t j |   } |  j | |  |  j | |  d S(   s   
        Jellying C{set} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        i   i   i   N(   R   R    R(   R3   RM   (   R   R-   RQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_set<  s    c         C   sT   t  d d d g  g } t j t j |   } |  j | |  |  j | |  d S(   s   
        Jellying C{frozenset} instances and then unjellying the result
        should produce objects which represent the values of the original
        inputs.
        i   i   i   N(   R   R    R(   R3   RM   (   R   R-   RQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_frozensetH  s    c         C   s,   t  d d d g  g } |  j | d  d S(   s   
        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.
        i   i   i   R   N(   R   R1   (   R   R-   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_setSecurityT  s    c         C   s,   t  d d d g  g } |  j | d  d S(   s   
        By default, C{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.
        i   i   i   R   N(   R   R1   (   R   R-   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_frozensetSecurity^  s    c         C   s   t  j j d d d g  g } t  j  |  } |  j | t  j  t d d d g  g   t  j |  } |  j t | d  t | d   t t  j j k r |  j | d t  j j  n |  j | d t  d S(   s   
        Test jellying C{sets.Set}: it should serialize to the same thing as
        C{set} jelly, and be unjellied as C{set} if available.
        i   i   i   i    N(   R    t   _setst   SetR3   R   R(   RV   R?   (   R   R-   t
   inputJellyRQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_oldSetsh  s    +$c         C   s   t  j j d d d g  g } t  j  |  } |  j | t  j  t d d d g  g   t  j |  } |  j t | d  t | d   t t  j j k r |  j | d t  j j  n |  j | d t  d S(   s   
        Test jellying C{sets.ImmutableSet}: it should serialize to the same
        thing as C{frozenset} jelly, and be unjellied as C{frozenset} if
        available.
        i   i   i   i    N(   R    Rf   t   ImmutableSetR3   R   R(   RV   R?   (   R   R-   Rh   RQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_oldImmutableSetsy  s    +$c         C   so   |  j  t d d  j t d d    t d d  } t j |  } t j |  } |  j  | j |   d S(   s%   
        Simplest test case.
        R2   R7   i   i   N(   t
   failUnlessR!   R$   R    R(   (   R   R2   t   cerealR7   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_simple  s    c         C   s   g  } | } | j  |  | j  |  |  j | d | d  |  j | d d |  t j |  } t j |  } |  j | d | d  |  j | d d |  d S(   sJ   
        Test to make sure that objects retain identity properly.
        i    i   N(   R	   R@   R    R(   (   R   R   R   t   st   z(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_identity  s    c         C   sT   t  d  } t j t j |   } |  j | |  |  j t |  t |   d  S(   Nt   blah(   t   unicodeR    R(   R3   t   type(   R   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_unicode  s    c         C   s   g  } i | d 6| f } | j  |  t j |  } t j |  } |  j | d d | d  |  j | d d d |  d  S(   NRV   i    i   (   R	   R    R(   R@   (   R   t   rereft   toplevelTupleRo   Rp   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_stressReferences  s    c         C   s]   g  } | f } | j  | f  t j |  } t j |  } |  j | d d d |  d  S(   Ni    (   R	   R    R(   R@   (   R   R2   RE   Ro   Rp   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_moreReferences  s    	c         C   s;   t  j   } t  j  i   } |  j t  j t  j | |  d S(   s@   
        Test for type-level security of serialization.
        N(   R    R&   R+   R,   R(   (   R   R0   t   dct(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_typeSecurity  s    c         C   s2   t  j  t  } t  j t  } |  j t |  d  S(   N(   R    R   R(   R@   (   R   t   jt   uj(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_newStyleClasses  s    c         C   s   t    } t j t j |   t j t j | j   t d d d g t d  t d  d d d d t  t i d d 6t  j g } x0 | D]( } |  j | t j t j |    q Wd S(	   sA   
        Test for all types currently supported in jelly
        i   i   i   t   testgL4@R2   N(   i   i   i   (	   R   R    R(   R   R   t   boolR   R   R3   (   R   R2   t   itemsR_   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_lotsaTypes  s    	("c         C   s   d d d     Ya  t   } t  |  } t  |  } t  | | f  } i | | 6| | 6| | 6| d 6} t j t j |   d } |  j | j d j | j d j  d  S(   Nt
   TupleStatec           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         S   s   | |  _  d  S(   N(   R#   (   R   R#   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR     s    c         S   s
   |  j  f S(   N(   R#   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR     s    c         S   s   | d |  _  d  S(   Ni    (   R#   (   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR     s    c         S   s   t  |  j  S(   N(   t   hashR#   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   __hash__  s    (   R   R   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR     s   			t   t3i    i   (    (   R   R   R    R(   R@   R#   (   R   R2   t   t1t   t2R   t   dt   t3prime(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_setState  s    		"c         C   s  t  j   } | j t t  t   } t   } t   } | | _ | | _ | | _ | | _ t  j  | |  } t  j	 | |  } |  j
 | j t  j  t  j  |  } |  j t  j t  j	 | |  |  j | j | j d  t  j  t |  } t  j	 | |  } |  j | t d |  d S(   sA   
        Test for class-level security of serialization.
        s   Identity mismatchs   A came back: %sN(   R    R&   t   allowInstancesOfR   R   R   R7   R/   R   R(   R?   R]   R+   R,   R@   (   R   R0   R2   R7   R/   t   friendlyR   t   mean(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_classSecurity  s$    							c         C   s   d t  j f d     Y} t  j | t  j  |   } d | _ t  j t  j  |   } |  j | j d  |  j | t  j  d S(   sr   
        Test that if Unjellyable is used to deserialize a jellied object,
        state comes out right.
        t   JellyableTestClassc           B   s   e  Z RS(    (   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR     s   t   valueN(   R    t	   Jellyablet   setUnjellyableForClasst   Unjellyablet	   attributeR(   R3   R?   (   R   R   RP   RQ   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_unjellyable  s    		c   	      C   s   i  d g } | d  } | d  } t  d d  } t  d d  } t  d d  } | | _ | | _ | | _ t j | d	 | } t j | d
 | } |  j | j | j j  |  j | d d  |  j | j | j d  d  S(   Ni   c         S   s2   | d d | d <|  | d | d <t  | d  S(   Ni   i    (   RI   (   t   objt   jelt   perst(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   persistentStore  s    c         S   s   t  |   } | d | S(   Ni    (   t   int(   t   pidstrt   unjR   t   pid(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   persistentLoad$  s    i   i   i   i   i   R   R   i    s   persistentStore was not called.s$   Persistent storage identity failure.(   R!   R7   R/   R    R(   R@   Rl   (	   R   R   R   R   R2   R7   R/   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_persistentStorage  s    			c         C   s_   t    } t  |  } t  |  } t  |  } t j |  } t j |  } |  j | |  d  S(   N(   R   R    R(   t   _check_newstyle(   R   RA   t   n1t   n11R=   R   RB   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_newStyleClassesAttributes8  s    	c         C   s   |  j  | j | j  |  j  | j d  |  j  | j d  |  j  t | j  t | j   x3 t | j | j  D] \ } } |  j | |  qt Wd  S(   Ni   (   t   assertEqualR   R   R[   R   t   zipR   (   R   R2   R7   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   D  s    ""c         C   s   t  j   } t  j   } | j t    t j | d | } t  j   } | j t    t j | d | } |  j | j | j	  d S(   s  
        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}.
        t   invokerN(
   R   t   Referenceablet   Brokert   makeConnectionR   R    R(   t   assertInt   luidt   localObjects(   R   t   reft   jellyBrokerR|   t   unjellyBrokerR}   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_referenceableM  s    N(*   R   R   R   R1   R9   R<   RC   RD   RG   RH   RJ   RR   RU   RW   RY   R`   Ra   RS   R   t
   skipReasont   skipRb   Rc   Rd   Re   Ri   Rk   Rn   Rq   Ru   Rx   Ry   R{   R~   R   R   R   R   R   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR%   x   sT   							
	
	
	
										
	
						
													t   ClassAc           B   s   e  Z d    Z RS(   c         C   s   t  |   |  _ d  S(   N(   t   ClassBR   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   b  s    (   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   a  s   R   c           B   s   e  Z d    Z RS(   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   h  s    (   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   g  s   t   CircularReferenceTestCasec           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sN   
    Tests for circular references handling in the jelly/unjelly process.
    c         C   sX   t  j t t  t  j t t  t  j t  j  t     } |  j | j j | d  d  S(   Ns,   Identity not preserved in circular reference(   R    R   R   R   R(   R@   R   (   R   R2   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_simpleCircler  s
    c         C   s   d d d     Y} |   } d  | _ t   } t j t t  t j t t  t j | d | } t j |  } |  j | j j | d  d  S(   Nt   DummyInvokerClassc           B   s   e  Z RS(    (   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   {  s   R   s,   Identity not preserved in circular reference(    (	   R   t   serializingPerspectiveR   R    R   R   R(   t   failUnlessIdenticalR   (   R   R   t   dummyInvokert   a0R|   t   a1(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   test_circleWithInvokerz  s    			c         C   sp   t    } t | d  } | j |  t j t j |   } |  j | j t   |  j t	 | j  | g  d S(   s   
        Check that a C{set} can contain a circular reference and be serialized
        and unserialized without losing the reference.
        N(
   R   R!   R   t   addR    R(   R?   R   R3   RV   (   R   Ro   R2   t   res(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyRb     s    	c         C   sr   t  d d  } t | g  } | | _ t j t j |   } |  j | j t  |  j t | j  | g  d S(   s   
        Check that a C{frozenset} can contain a circular reference and be
        serializeserialized without losing the reference.
        N(	   R!   R   R   R   R    R(   R?   R3   RV   (   R   R2   Ro   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyRc     s    	(   R   R   R   R   R   Rb   Rc   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyR   m  s
   			(    R   RK   RS   t   ImportErrorR   t   twisted.spreadR    R   t   twisted.python.compatR   R   t   twisted.trialR   t   twisted.test.proto_helpersR   t   objectR   R   R   R   R   R   R   R   R!   t   TestCaseR%   t   Copyablet
   RemoteCopyR   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_jelly.pyt   <module>   s,   
	
 