<s> from autoissue import findIssuesInFile <EOL> from autoissue import getFiles <EOL> from autoissue import Issue <EOL> from autoissue import parseIssueFromRawComment <EOL> import unittest <EOL> debug = False <EOL> TEST_PREFIX = "<STR_LIT>" <EOL> def getExpected ( file , t , l , i ) : <EOL> title = None <EOL> label = [ ] <EOL> issue = None <EOL> if t : <EOL> title = "<STR_LIT>" <EOL> if l : <EOL> label = [ '<STR_LIT>' ] <EOL> if i : <EOL> issue = <NUM_LIT> <EOL> if debug : <EOL> print "<STR_LIT>" , "<STR_LIT>" if t else "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" if l else "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" if i else "<STR_LIT>" <EOL> return Issue ( title , "<STR_LIT>" , <NUM_LIT:0> , file , label , issue ) <EOL> def getIssueFromFile ( file ) : <EOL> testfile = TEST_PREFIX + file <EOL> with open ( testfile ) as f : <EOL> comment = f . read ( ) <EOL> result = parseIssueFromRawComment ( comment , <NUM_LIT:0> , testfile ) <EOL> result . title = "<STR_LIT>" <EOL> return result <EOL> class TestCommentParsing ( unittest . TestCase ) : <EOL> def testFiles ( self ) : <EOL> files = getFiles ( "<STR_LIT>" ) <EOL> for file in files : <EOL> numFound = len ( findIssuesInFile ( file ) ) <EOL> with open ( file . replace ( "<STR_LIT:input>" , "<STR_LIT>" ) ) as f : <EOL> expected = int ( f . read ( ) ) <EOL> self . assertEqual ( numFound , expected ) <EOL> def testBlockIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , False ) ) <EOL> def testBlockIssueLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , True ) ) <EOL> def testBlockIssueLabelTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockIssueTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , False ) ) <EOL> def testBlockIssueTitleLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , False , True ) ) <EOL> def testBlockLabelIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , True ) ) <EOL> def testBlockLabelIssueTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockLabelTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , True ) ) <EOL> def testBlockLabelTitleIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockNone ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , False , False ) ) <EOL> def testBlockTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , False ) ) <EOL> def testBlockTitleIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , False ) ) <EOL> def testBlockTitleIssueLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockTitleLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , True ) ) <EOL> def testBlockTitleLabelIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testBlockIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , False ) ) <EOL> def testLineIssueLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , True ) ) <EOL> def testLineIssueLabelTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testLineIssueTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , False ) ) <EOL> def testLineIssueTitleLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testLineLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , False , True ) ) <EOL> def testLineLabelIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , True , True ) ) <EOL> def testLineLabelIssueTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testLineLabelTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , True ) ) <EOL> def testLineLabelTitleIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testLineNone ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , False , False , False ) ) <EOL> def testLineTitle ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , False ) ) <EOL> def testLineTitleIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , False ) ) <EOL> def testLineTitleIssueLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def testLineTitleLabel ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , False , True ) ) <EOL> def testLineTitleLabelIssue ( self ) : <EOL> self . assertEqual ( getIssueFromFile ( "<STR_LIT>" ) , getExpected ( file , True , True , True ) ) <EOL> def main ( ) : <EOL> unittest . main ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
