ó
P'^c           @   sd   d  d l  Z  d  d l Z d  d l m Z d  d l Z d  d l m Z m Z d e f d     YZ	 d S(   iÿÿÿÿN(   t   TestCase(   t	   text_typet   bt
   TestErrorsc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C   s   i d d 6d d 6d d 6d d 6g } y t  j |  Wn! t k
 rY t j   d
 } n X|  j d  |  j t |  d  d  S(   Nt   At   ai   i   R   g      @t   cs   D tuplet   di   s   Expected TypeErrors5   keys must be str, int, float, bool or None, not tuple(   i   i   (   R   (   t   jsont   dumpst	   TypeErrort   syst   exc_infot   failt   assertEqualt   str(   t   selft   datat   err(    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   test_string_keys_error   s    %c         C   s\   y t  j t   Wn! t k
 r4 t j   d } n X|  j d  |  j t |  d  d  S(   Ni   s   Expected TypeErrors.   Object of type module is not JSON serializable(   R   R	   R
   R   R   R   R   R   (   R   R   (    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   test_not_serializable   s    c         C   s   d  } y t j d  Wn$ t j k
 r= t j   d } n X|  j d  |  j | j d  |  j | j	 d  |  j | j
 d  |  j | j d  d  S(   Ns   {}
a
bi   s   Expected JSONDecodeErrori   i   (   t   NoneR   t   loadst   JSONDecodeErrorR   R   R   R   t   linenot   colnot	   endlinenot   endcolno(   R   R   (    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   test_decode_error   s    c         C   s   d  } x t t f D]w } y t j | d   Wn$ t j k
 rV t j   d } n X|  j d  |  j	 | j
 d  |  j	 | j d  q Wd  S(   Ns
   {"asdf": "i   s   Expected JSONDecodeErrori
   (   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   t   t(    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   test_scan_error*   s    c         C   sÅ   d  } y t j d  Wn$ t j k
 r= t j   d } n X|  j d  t j |  } t j |  } |  j	 | j
 | j
  |  j	 | j | j  |  j	 | j | j  |  j	 | j | j  d  S(   Ns   {}
a
bi   s   Expected JSONDecodeError(   R   R   R   R   R   R   R   t   pickleR	   R   t   msgt   doct   post   end(   R   R   t   st   e(    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   test_error_is_pickable6   s    (   t   __name__t
   __module__R   R   R   R   R&   (    (    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyR      s
   		
		(
   R   R   t   unittestR    t
   simplejsonR   t   simplejson.compatR   R   R   (    (    (    s>   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_errors.pyt   <module>   s   