
'![c           @   sX   d  Z  d d l Z d d l m Z d d l m Z m Z m Z d e f d     YZ d S(   s!   Unittest for the logging checker.iN(   t   logging(   t   CheckerTestCaset   Messaget
   set_configt   TestLoggingModuleDetectionc           B   sJ   e  Z e j Z d    Z d   Z d   Z e d d d g  d    Z	 RS(   c         C   sq   t  j d  } |  j j d   |  j j | d  |  j t d d | d   |  j j | d  Wd  QXd  S(   NsI   
        import logging #@
        logging.warn('%s' % '%s')  #@
        i    s   logging-not-lazyt   nodei   (	   t   astroidt   extract_nodet   checkert   visit_modulet   Nonet   visit_importt   assertAddsMessagesR   t
   visit_call(   t   selft   stmts(    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyt$   test_detects_standard_logging_module   s    	 c         C   s    t  j d  } |  j |  d  S(   NsO   
        import logging
        logging.error('0} - {1}'.format(1, 2))
        (   R   t   parset   walk(   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyt(   test_dont_crash_on_invalid_format_string   s    	c         C   sq   t  j d  } |  j j d   |  j j | d  |  j t d d | d   |  j j | d  Wd  QXd  S(   NsV   
        import logging as blogging #@
        blogging.warn('%s' % '%s')  #@
        i    s   logging-not-lazyR   i   (	   R   R   R   R	   R
   R   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyt,   test_detects_renamed_standard_logging_module%   s    	 t   logging_modulesR    s
   my.loggingc         C   sq   t  j d  } |  j j d   |  j j | d  |  j t d d | d   |  j j | d  Wd  QXd  S(   Ns^   
        from my import logging as blogging #@
        blogging.warn('%s' % '%s')  #@
        i    s   logging-not-lazyR   i   (	   R   R   R   R	   R
   R   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyt   test_nonstandard_logging_module/   s    	 (
   t   __name__t
   __module__R    t   LoggingCheckert   CHECKER_CLASSR   R   R   R   R   (    (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyR      s
   		
		
(	   t   __doc__R   t   pylint.checkersR    t   pylint.testutilsR   R   R   R   (    (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_logging.pyt   <module>
   s   