#NEWLINE# def test_body_min_length( self ) : #NEWLINE# #INDENT# rule = rules . BodyMinLength ( ) #NEWLINE# gitcontext = self . gitcontext ( 'Title\n\nThis is the second body line\n' ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# gitcontext = self . gitcontext ( 'Title\n' ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# gitcontext = self . gitcontext ( 'Title\n\nsecond\nthird\n' ) #NEWLINE# violations = rule . validate ( self . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertIsNone ( violations ) #NEWLINE# expected_violation = rules . RuleViolation ( 'B5' , 'Body message is too short (8<20)' , 'tooshort' , 3 ) #NEWLINE# gitcontext = self . gitcontext ( 'Title\n\ntooshort\n' ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertListEqual ( violations , [ expected_violation ] ) #NEWLINE# expected_violation = rules . RuleViolation ( 'B5' , 'Body message is too short (21<120)' , ( 'a' * 21 ) , 3 ) #NEWLINE# rule = rules . BodyMinLength ( { #NEWLINE# #INDENT# 'min-length' : 120 , #NEWLINE# #UNINDENT# } ) #NEWLINE# gitcontext = self . gitcontext ( ( 'Title\n\n%s\n' % ( 'a' * 21 ) ) ) #NEWLINE# violations = rule . validate ( gitcontext . commits [ ( - 1 ) ] , gitcontext ) #NEWLINE# self . assertListEqual ( violations , [ expected_violation ] )