<s> import lintreview . tools as tools <EOL> import github3 <EOL> from lintreview . config import ReviewConfig , build_review_config <EOL> from lintreview . review import Review <EOL> from lintreview . review import Problems <EOL> from nose . tools import eq_ , raises <EOL> from mock import Mock <EOL> sample_ini = """<STR_LIT>""" <EOL> simple_ini = """<STR_LIT>""" <EOL> bad_ini = """<STR_LIT>""" <EOL> @ raises ( ImportError ) <EOL> def test_factory_raises_error_on_bad_linter ( ) : <EOL> gh = Mock ( spec = github3 . GitHub ) <EOL> config = build_review_config ( bad_ini ) <EOL> config = ReviewConfig ( ) <EOL> config . load_ini ( bad_ini ) <EOL> tools . factory ( Review ( gh , None ) , config , '<STR_LIT>' ) <EOL> def test_factory_generates_tools ( ) : <EOL> gh = Mock ( spec = github3 . GitHub ) <EOL> config = build_review_config ( sample_ini ) <EOL> linters = tools . factory ( Review ( gh , None ) , config , '<STR_LIT>' ) <EOL> eq_ ( <NUM_LIT:2> , len ( linters ) ) <EOL> assert isinstance ( linters [ <NUM_LIT:0> ] , tools . pep8 . Pep8 ) <EOL> assert isinstance ( linters [ <NUM_LIT:1> ] , tools . jshint . Jshint ) <EOL> def test_tool_constructor__config ( ) : <EOL> problems = Problems ( ) <EOL> config = { '<STR_LIT>' : '<STR_LIT:value>' } <EOL> tool = tools . Tool ( problems , config ) <EOL> eq_ ( tool . options , config ) <EOL> tool = tools . Tool ( problems , '<STR_LIT>' ) <EOL> eq_ ( tool . options , { } ) <EOL> tool = tools . Tool ( problems , <NUM_LIT:2> ) <EOL> eq_ ( tool . options , { } ) <EOL> tool = tools . Tool ( problems , None ) <EOL> eq_ ( tool . options , { } ) <EOL> def test_run ( ) : <EOL> config = build_review_config ( simple_ini ) <EOL> problems = Problems ( ) <EOL> files = [ '<STR_LIT>' ] <EOL> tools . run ( config , problems , files , [ ] , '<STR_LIT>' ) <EOL> eq_ ( <NUM_LIT:6> , len ( problems ) ) <EOL> def test_run__filter_files ( ) : <EOL> config = build_review_config ( simple_ini ) <EOL> problems = Problems ( ) <EOL> files = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> tools . run ( config , problems , files , [ ] , '<STR_LIT>' ) <EOL> eq_ ( <NUM_LIT:6> , len ( problems ) ) </s>
