ó
P'—^c           @   sd   d  d l  Z  d  d l m Z d  d l Z d  d l Z d  d l m Z m Z d e f d „  ƒ  YZ	 d S(   iÿÿÿÿN(   t   TestCase(   t   bt   PY3t   TestScanStringc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   |  j  t j j ƒ d  S(   N(   t   _test_scanstringt
   simplejsont   decodert   py_scanstring(   t   self(    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   test_py_scanstring   s    c         C   sP   t  j j s d  S|  j t  j j ƒ |  j t t  j j d d ƒ d t ƒ ƒ d  S(   Ns   ""i    (   R   R   t   c_scanstringR   t
   assertTruet
   isinstancet   str(   R   (    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   test_c_scanstring   s    c         C   s7  t  j d k r1 |  j | d d d  t ƒ dH ƒ n |  j | d d d  t ƒ dI ƒ |  j | d d d  t ƒ dJ ƒ |  j | d
 d d  t ƒ dK ƒ |  j | d d d  t ƒ dL ƒ |  j | d d d  t ƒ dM ƒ |  j | d d d  t ƒ dN ƒ |  j | d d d  t ƒ dO ƒ |  j | d d d  t ƒ dP ƒ |  j | d d d  t ƒ dQ ƒ |  j | d d d  t ƒ dR ƒ |  j | d! d d  t ƒ dS ƒ |  j | d# d d  t ƒ dT ƒ |  j | d% d d  t ƒ dU ƒ |  j | d( d d  t ƒ dV ƒ |  j | d* d d  t ƒ dW ƒ |  j | d- d d  t ƒ dX ƒ |  j | d0 d d  t ƒ dY ƒ |  j | d3 d d  t ƒ dZ ƒ |  j | d6 d d  t ƒ d[ ƒ |  j | d8 d d  t ƒ d\ ƒ xi t t t d; d< ƒ ƒ D]O } |  j | | d= d; d  t ƒ | d f ƒ |  j	 t
 | | d= d; d  t ƒ q¶W|  j	 t
 | d> d; d  t ƒ |  j	 t
 | d? d; d  t ƒ |  j	 t
 | d@ d; d  t ƒ |  j	 t
 | dA d; d  t ƒ |  j	 t
 | dB d; d  t ƒ |  j	 t
 | dC d; d  t ƒ |  j	 t
 | dD d; d  t ƒ |  j	 t
 | dE d; d  t ƒ t  j d k r3|  j	 t
 | dF d; d  t ƒ |  j	 t
 | dG d; d  t ƒ n  d  S(]   Niÿÿ  u   "zð„ x"i   u   zð„ xi   i   s   "\u007b"u   {i   s<   "A JSON payload should be an object or array, not a string."u:   A JSON payload should be an object or array, not a string.i<   s   ["Unclosed array"i   u   Unclosed arrayi   s   ["extra comma",]u   extra commai   s   ["double extra comma",,]u   double extra commai   s   ["Comma after the close"],u   Comma after the closei   s   ["Extra close"]]u   Extra closes   {"Extra comma": true,}u   Extra commas:   {"Extra value after close": true} "misplaced quoted value"u   Extra value after closei   s   {"Illegal expression": 1 + 2}u   Illegal expressions   {"Illegal invocation": alert()}u   Illegal invocations+   {"Numbers cannot have leading zeroes": 013}u"   Numbers cannot have leading zeroesi%   s   {"Numbers cannot be hex": 0x14}u   Numbers cannot be hexs2   [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]u   Too deepi   s   {"Missing colon" null}u   Missing coloni   s   {"Double colon":: null}u   Double coloni   s    {"Comma instead of colon", null}u   Comma instead of coloni   s!   ["Colon instead of comma": false]u   Colon instead of commas   ["Bad value", truth]u	   Bad valuei   i    i   t   "t    t   as   \s   \us   \u0s   \u01s   \u012s   \u0123s	   \ud834\u"s   \ud834\x0123"(   u   zð„ xi   (   u   zð„ xi   (   u   {i   (   u:   A JSON payload should be an object or array, not a string.i<   (   u   Unclosed arrayi   (   u   extra commai   (   u   double extra commai   (   u   Comma after the closei   (   u   Extra closei   (   u   Extra commai   (   u   Extra value after closei   (   u   Illegal expressioni   (   u   Illegal invocationi   (   u"   Numbers cannot have leading zeroesi%   (   u   Numbers cannot be hexi   (   u   Too deepi   (   u   Missing coloni   (   u   Double coloni   (   u   Comma instead of coloni   (   u   Colon instead of commai   (   u	   Bad valuei   (   t   syst
   maxunicodet   assertEqualt   Nonet   Truet   mapt   chrt   ranget   Falset   assertRaisest
   ValueError(   R   t
   scanstringt   c(    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyR      s¨    
		c         C   sB   |  j  t t j j d d d ƒ |  j  t t j j t d ƒ ƒ d  S(   Nt   xxxi   s   xxÿ(	   R   R   t   jsonR   R   t   UnicodeDecodeErrort   encodert   encode_basestring_asciiR   (   R   (    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   test_issue3623‡   s    	c         C   sT   t  t d t  t d d  ƒ ƒ } | d  k	 s0 t ‚ |  j t t j j d | d ƒ d  S(   Nt   maxsizet   maxintR   i   (	   t   getattrR   R   t   AssertionErrorR   t   OverflowErrorR    R   R   (   R   R%   (    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   test_overflow   s    c            s  t  j j ‰  t ‡  ‡ f d † } | d d ƒ | d d ƒ | d d ƒ | d d	 ƒ | d
 d ƒ | d d	 ƒ | d d j d d g ƒ ƒ | d d j d d g ƒ ƒ | d j d d g ƒ d j d d g ƒ d t ƒˆ j t ˆ  d d d  t ƒ ˆ j t ˆ  d d d  t ƒ d  S(   Nc            s…   |  g } t  r/ | r/ | j |  j d ƒ ƒ n  xO | D]G }  ˆ  |  d d  t ƒ \ } } ˆ j t |  ƒ | ƒ ˆ j | | ƒ q6 Wd  S(   Nt   utf8i   (   R   t   appendt   encodeR   R   R   t   len(   t   givent   expectt	   test_utf8t   givenst   rest   count(   R   R   (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt
   assertScan—   s    	u   "z\ud834\u0079x"u   zí ´yxu   "z\ud834\udd20x"u   zð„ xu   "z\ud834\ud834\udd20x"u	   zí ´ð„ xu
   "z\ud834x"u   zí ´xu
   "z\udd20x"u   zí´ xu   "zí ´x"u   "z\ud834í´ x12345"u    u   zí ´u	   í´ x12345u   "zí ´\udd20x"u   í´ xu   "zí ´u   í´ x"R1   u	   "z\ud83x"i   u   "z\ud834\udd2x"(	   R    R   R   R   t   joinR   R   R   R   (   R   R5   (    (   R   R   sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   test_surrogates”   sD    			(   t   __name__t
   __module__R	   R   R   R$   R*   R7   (    (    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyR      s   				l		(
   R   t   unittestR    R   R    t   simplejson.decodert   simplejson.compatR   R   R   (    (    (    sB   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_scanstring.pyt   <module>   s
   