<s> from lintreview . review import Problems <EOL> from lintreview . review import Comment <EOL> from lintreview . tools . pep8 import Pep8 <EOL> from unittest import TestCase <EOL> from nose . tools import eq_ <EOL> class TestPep8 ( TestCase ) : <EOL> fixtures = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> def setUp ( self ) : <EOL> self . problems = Problems ( ) <EOL> self . tool = Pep8 ( self . problems ) <EOL> def test_match_file ( self ) : <EOL> self . assertFalse ( self . tool . match_file ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( self . tool . match_file ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( self . tool . match_file ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( self . tool . match_file ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( self . tool . match_file ( '<STR_LIT>' ) ) <EOL> def test_process_files__one_file_pass ( self ) : <EOL> self . tool . process_files ( [ self . fixtures [ <NUM_LIT:0> ] ] ) <EOL> eq_ ( [ ] , self . problems . all ( self . fixtures [ <NUM_LIT:0> ] ) ) <EOL> def test_process_files__one_file_fail ( self ) : <EOL> self . tool . process_files ( [ self . fixtures [ <NUM_LIT:1> ] ] ) <EOL> problems = self . problems . all ( self . fixtures [ <NUM_LIT:1> ] ) <EOL> eq_ ( <NUM_LIT:6> , len ( problems ) ) <EOL> fname = self . fixtures [ <NUM_LIT:1> ] <EOL> expected = Comment ( fname , <NUM_LIT:2> , <NUM_LIT:2> , '<STR_LIT>' ) <EOL> eq_ ( expected , problems [ <NUM_LIT:0> ] ) <EOL> expected = Comment ( fname , <NUM_LIT:11> , <NUM_LIT:11> , "<STR_LIT>" ) <EOL> eq_ ( expected , problems [ <NUM_LIT:5> ] ) <EOL> def test_process_files_two_files ( self ) : <EOL> self . tool . process_files ( self . fixtures ) <EOL> eq_ ( [ ] , self . problems . all ( self . fixtures [ <NUM_LIT:0> ] ) ) <EOL> problems = self . problems . all ( self . fixtures [ <NUM_LIT:1> ] ) <EOL> eq_ ( <NUM_LIT:6> , len ( problems ) ) <EOL> expected = Comment ( self . fixtures [ <NUM_LIT:1> ] , <NUM_LIT:2> , <NUM_LIT:2> , '<STR_LIT>' ) <EOL> eq_ ( expected , problems [ <NUM_LIT:0> ] ) <EOL> expected = Comment ( self . fixtures [ <NUM_LIT:1> ] , <NUM_LIT:11> , <NUM_LIT:11> , "<STR_LIT>" ) <EOL> eq_ ( expected , problems [ <NUM_LIT:5> ] ) <EOL> def test_config_options_and_process_file ( self ) : <EOL> options = { <EOL> '<STR_LIT:ignore>' : '<STR_LIT>' <EOL> } <EOL> self . tool = Pep8 ( self . problems , options ) <EOL> self . tool . process_files ( [ self . fixtures [ <NUM_LIT:1> ] ] ) <EOL> problems = self . problems . all ( self . fixtures [ <NUM_LIT:1> ] ) <EOL> eq_ ( <NUM_LIT:4> , len ( problems ) ) <EOL> for p in problems : <EOL> self . assertFalse ( '<STR_LIT>' in p . body ) <EOL> self . assertFalse ( '<STR_LIT>' in p . body ) </s>
