ó
P'—^c           @   s5   d  d l  Z  d  d l Z d e  j f d „  ƒ  YZ d S(   iÿÿÿÿNt   TestEncodeForHTMLc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s7   t  j ƒ  |  _ t  j ƒ  |  _ t  j d t ƒ |  _ d  S(   Nt   ensure_ascii(   t   jsont   JSONDecodert   decodert   JSONEncoderForHTMLt   encodert   Falset   non_ascii_encoder(   t   self(    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   setUp   s    c         C   st   |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ d  S(	   Ns   "\u0026"t   &s   "\u003c"t   <s   "\u003e"t   >s   "\u2028"u   â€¨(   t   assertEqualR   t   encode(   R	   (    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   test_basic_encode   s    c         C   st   |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ |  j  d |  j j d ƒ ƒ d  S(	   Ns   "\u0026"R   s   "\u003c"R   s   "\u003e"R   s   "\u2028"u   â€¨(   R   R   R   (   R	   (    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   test_non_ascii_basic_encode   s    c         C   s=   x6 d D]. } |  j  | |  j j |  j j | ƒ ƒ ƒ q Wd  S(   Ns   &<>(   R   R   t   decodeR   R   (   R	   t   char(    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   test_basic_roundtrip   s    c         C   sN   d } |  j  d |  j j | ƒ ƒ |  j  | |  j j |  j j | ƒ ƒ ƒ d  S(   Ns)   </script><script>alert("gotcha")</script>sK   "\u003c/script\u003e\u003cscript\u003ealert(\"gotcha\")\u003c/script\u003e"(   R   R   R   R   R   (   R	   t
   bad_string(    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   test_prevent_script_breakout   s    (   t   __name__t
   __module__R
   R   R   R   R   (    (    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyR       s
   				(   t   unittestt
   simplejsonR   t   TestCaseR    (    (    (    sG   /tmp/pip-unpacked-wheel-9xjeDh/simplejson/tests/test_encode_for_html.pyt   <module>   s   