Example #1
0
def run(csv_file_path):
    if not os.path.exists(csv_file_path) or os.path.isdir(csv_file_path):
        print 'Invalid file path given, please provide a valid csv file path'
        return

    parser = CSVParser(csv_file_path)
    try:
        raw_data = parser.parse()
    except ParseError as e:
        print 'Parse Error: ' + e
        return

    scoring_engine = ScoringEngine(raw_data)
    try:
        scoring_engine.process()
    except ScoringEngineError as e:
        print 'Exception occurred: ' + str(e)
        return
    except Exception as e:
        print 'Unknown Error: ' + str(e)
        return
Example #2
0
 def test_parse(self):
     parser = CSVParser('sample_data.csv')
     rows = parser.parse()
     self.assertTrue(len(rows) > 0)