ó
ìUzMc           @   sb   d  d l  m Z d  d l Z d d	 d „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(
   iÿÿÿÿ(   t   TestCaseNt   JSONTestObjectc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyR      s   t   RecursiveJSONEncoderc           B   s   e  Z e Z d  „  Z RS(   c         C   s3   | t  k r# |  j r t  g Sd Sn  t j j | ƒ S(   NR   (   R   t   recurset   jsont   JSONEncodert   default(   t   selft   o(    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyR      s
    	(   R   R   t   FalseR   R   (    (    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyR   	   s   t   TestRecursionc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s¶   g  } | j  | ƒ y t j | ƒ Wn t k
 r7 n X|  j d ƒ g  } | g } | j  | ƒ y t j | ƒ Wn t k
 r… n X|  j d ƒ g  } | | g } t j | ƒ d  S(   Ns)   didn't raise ValueError on list recursions5   didn't raise ValueError on alternating list recursion(   t   appendR   t   dumpst
   ValueErrort   fail(   R	   t   xt   y(    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyt   test_listrecursion   s$    	c         C   sm   i  } | | d <y t  j | ƒ Wn t k
 r4 n X|  j d ƒ i  } i | d 6| d 6} t  j | ƒ d  S(   Nt   tests)   didn't raise ValueError on dict recursiont   at   b(   R   R   R   R   (   R	   R   R   (    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyt   test_dictrecursion,   s    
c         C   sa   t  ƒ  } |  j | j t ƒ d ƒ t | _ y | j t ƒ Wn t k
 rO n X|  j d ƒ d  S(   Ns   "JSONTestObject"s,   didn't raise ValueError on default recursion(   R   t   assertEqualst   encodeR   t   TrueR   R   R   (   R	   t   enc(    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyt   test_defaultrecursion:   s    		(   R   R   R   R   R   (    (    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyR      s   		(    (   t   unittestR    t
   simplejsonR   R   R   R   R   (    (    (    sC   /usr/lib/python2.7/dist-packages/simplejson/tests/test_recursion.pyt   <module>   s   