#NEWLINE# def test_body_changed_file_mention( self ) : #NEWLINE# #INDENT# rule = rules . BodyChangedFileMention ( ) #NEWLINE# gitcontext = self . gitcontext ( 'This is a test\n\nHere is a mention of foo/test.py' ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# rule = rules . BodyChangedFileMention ( { #NEWLINE# #INDENT# 'files' : 'bar.txt,foo/test.py' , #NEWLINE# #UNINDENT# } ) #NEWLINE# gitcontext = self . gitcontext ( 'This is a test\n\nHere is a mention of foo/test.py' ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# gitcontext = self . gitcontext ( 'This is a test\n\nHere is a mention of foo/test.py' , [ 'foo/test.py' ] ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# commit_msg = 'This is a test\n\nHere is a mention of foo/test.py\nAnd here is a mention of bar.txt' #NEWLINE# gitcontext = self . gitcontext ( commit_msg , [ 'foo/test.py' , 'bar.txt' ] ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# commit_msg = 'This is a test\n\nHere is a mention of\nAnd here is a mention of bar.txt' #NEWLINE# gitcontext = self . gitcontext ( commit_msg , [ 'foo/test.py' , 'bar.txt' ] ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# expected_violation = rules . RuleViolation ( 'B7' , "Body does not mention changed file 'foo/test.py'" , None , 4 ) #NEWLINE# self . assertEqual ( [ expected_violation ] , violations ) #NEWLINE# commit_msg = 'This is a test\n\nHere is a mention of\nAnd here is a mention of' #NEWLINE# gitcontext = self . gitcontext ( commit_msg , [ 'foo/test.py' , 'bar.txt' ] ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# expected_violation_2 = rules . RuleViolation ( 'B7' , "Body does not mention changed file 'bar.txt'" , None , 4 ) #NEWLINE# self . assertEqual ( [ expected_violation_2 , expected_violation ] , violations )