σ
§]c           @   s@   d  Z  d d l m Z d d l m Z d e f d     YZ d S(   s*   Tests for the HighlightMagics preprocessori   (   t   PreprocessorTestsBasei   (   t   HighlightMagicsPreprocessort   TestHighlightMagicsc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s.   Contains test functions for highlightmagics.pyc         C   s   t    } t | _ | S(   s"   Make an instance of a preprocessor(   R   t   Truet   enabled(   t   selft   preprocessor(    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyt   build_preprocessor   s    		c         C   s   |  j    d S(   s1   Can a HighlightMagicsPreprocessor be constructed?N(   R   (   R   (    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyt   test_constructor   s    c         C   s   |  j    } |  j   } |  j   } d | j d _ | | |  \ } } d | j d d k sf t  |  j | j d d d d  d S(   s,   Test the HighlightMagicsPreprocessor taggings―   %%R -i x,y -o XYcoef
            lm.fit <- lm(y~x)
            par(mfrow=c(2,2))
            print(summary(lm.fit))
            plot(lm.fit)
            XYcoef <- coef(lm.fit)i    t   magics_languaget   metadatat   rN(   t   build_notebookt   build_resourcesR   t   cellst   sourcet   AssertionErrort   assertEqual(   R   t   nbt   resR   (    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyt   test_tagging   s    c         C   sj   |  j    } |  j   } |  j   } d | j d _ | | |  \ } } d | j d d k sf t  d S(   sB   Test that HighlightMagicsPreprocessor does not tag false positivessh   # this should not be detected
                print("""
                %%R -i x, y
                """)i    R	   R
   N(   R   R   R   R   R   R   (   R   R   R   R   (    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyt   test_no_false_positive'   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyR      s
   			N(   R   t   baseR    t   highlightmagicsR   R   (    (    (    sQ   lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_highlightmagics.pyt   <module>   s   