ó
§‰]c           @   sb   d  Z  d d l Z d d l m Z m Z d d l m Z d d l m Z d e f d	 „  ƒ  YZ	 d S(
   s4   
Module with tests for the RegexRemovePreprocessor.
iÿÿÿÿN(   t   v4t	   from_dicti   (   t   PreprocessorTestsBasei   (   t   RegexRemovePreprocessort   TestRegexRemovec           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s*   Contains test functions for regexremove.pyc         C   sY   t  t |  ƒ j ƒ  } | j j t j d ƒ t j d ƒ t j d ƒ t j d ƒ g ƒ | S(   Nt    t    s   
s   	(	   t   superR   t   build_notebookt   cellst   extendt   nbformatt   new_code_cellt   new_markdown_cellt   new_raw_cell(   t   selft   notebook(    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyR      s    	c         C   s   t  ƒ  } t | _ | S(   s"   Make an instance of a preprocessor(   R   t   Truet   enabled(   R   t   preprocessor(    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyt   build_preprocessor   s    		c         C   s   |  j  ƒ  d S(   s-   Can a RegexRemovePreprocessor be constructed?N(   R   (   R   (    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyt   test_constructor$   s    c   
      C   sC  i d g d 6d d g d 6} i d d 6d d 6d	 d 6d d
 6} xý d d d d
 g D]é } |  j  ƒ  } |  j ƒ  } |  j ƒ  } | d
 k r” g  | _ n | j j | j | g  ƒ ƒ | | | ƒ \ } } |  j t | j ƒ | | ƒ t	 t
 t j | j ƒ ƒ } x; | j D]0 } x' | D] }	 |  j |	 j | j ƒ ƒ qWqWqR Wd S(   s.   Test the output of the RegexRemovePreprocessors   \s*\Zt   disallow_whitespaces   \t\Zs   \n\Zt   disallow_tab_newlinei   t   defaulti   i   t   noneN(   R   t   build_resourcesR   t   patternsR
   t   gett   assertEqualt   lenR	   t   listt   mapt   ret   compilet   assertFalset   matcht   source(
   R   t   pattern_lookupt   expected_cell_countt   methodt   nbt   resR   R   t   cellt   pattern(    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyt   test_output(   s*    

c         C   sr   i d d 6d d 6i  d 6i d d 6d d	 6d
 d 6g d 6d d 6} |  j  ƒ  } t | ƒ } | j | ƒ sn t ‚ d S(   s†   
        Test that the check_conditions returns true when given a code-cell
        that has non-empty outputs but no source.
        t   codet	   cell_typei   t   execution_countt   metadatat   stdoutt   namet   streamt   output_types	   I exist.
t   textt   outputsR   R%   N(   R   R   t   check_conditionst   AssertionError(   R   R+   R   t   node(    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyt   test_nosource_with_outputH   s    
(   t   __name__t
   __module__t   __doc__R   R   R   R-   R;   (    (    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyR      s   				 (
   R>   R!   R   R    R   t   baseR   t   regexremoveR   R   (    (    (    sM   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_regexremove.pyt   <module>   s
   