<s> """<STR_LIT>""" <EOL> __author__ = ( '<STR_LIT>' ) <EOL> import StringIO <EOL> import mox <EOL> import unittest as googletest <EOL> from closure_linter import errors <EOL> from closure_linter import runner <EOL> from closure_linter . common import error <EOL> from closure_linter . common import errorhandler <EOL> from closure_linter . common import tokens <EOL> class LimitedDocTest ( googletest . TestCase ) : <EOL> def testIsLimitedDocCheck ( self ) : <EOL> self . assertTrue ( runner . _IsLimitedDocCheck ( '<STR_LIT>' , [ '<STR_LIT>' ] ) ) <EOL> self . assertFalse ( runner . _IsLimitedDocCheck ( '<STR_LIT>' , [ '<STR_LIT>' ] ) ) <EOL> self . assertTrue ( runner . _IsLimitedDocCheck ( <EOL> '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> self . assertFalse ( runner . _IsLimitedDocCheck ( <EOL> '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> class RunnerTest ( googletest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . mox = mox . Mox ( ) <EOL> def testRunOnMissingFile ( self ) : <EOL> mock_error_handler = self . mox . CreateMock ( errorhandler . ErrorHandler ) <EOL> def ValidateError ( err ) : <EOL> return ( isinstance ( err , error . Error ) and <EOL> err . code is errors . FILE_NOT_FOUND and <EOL> err . token is None ) <EOL> mock_error_handler . HandleFile ( '<STR_LIT>' , None ) <EOL> mock_error_handler . HandleError ( mox . Func ( ValidateError ) ) <EOL> mock_error_handler . FinishFile ( ) <EOL> self . mox . ReplayAll ( ) <EOL> runner . Run ( '<STR_LIT>' , mock_error_handler ) <EOL> self . mox . VerifyAll ( ) <EOL> def testBadTokenization ( self ) : <EOL> mock_error_handler = self . mox . CreateMock ( errorhandler . ErrorHandler ) <EOL> def ValidateError ( err ) : <EOL> return ( isinstance ( err , error . Error ) and <EOL> err . code is errors . FILE_IN_BLOCK and <EOL> err . token . string == '<STR_LIT:}>' ) <EOL> mock_error_handler . HandleFile ( '<STR_LIT>' , mox . IsA ( tokens . Token ) ) <EOL> mock_error_handler . HandleError ( mox . Func ( ValidateError ) ) <EOL> mock_error_handler . HandleError ( mox . IsA ( error . Error ) ) <EOL> mock_error_handler . FinishFile ( ) <EOL> self . mox . ReplayAll ( ) <EOL> source = StringIO . StringIO ( _BAD_TOKENIZATION_SCRIPT ) <EOL> runner . Run ( '<STR_LIT>' , mock_error_handler , source ) <EOL> self . mox . VerifyAll ( ) <EOL> _BAD_TOKENIZATION_SCRIPT = """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> googletest . main ( ) </s>
