Esempio n. 1
0
def main():
    fname = 'fake_va_elec_results.csv'
    path = join(dirname(dirname(__file__)), fname)
    download_results(path)
    results = parse_and_clean(path)
    summary = summarize(results)
    write_csv(summary)
def main():
    fname = 'fake_va_elec_results.csv'
    path = join(dirname(dirname(abspath(__file__))), fname)
    download_results(path)
    results = parse_and_clean(path)
    summary = summarize(results)
    write_csv(summary)
Esempio n. 3
0
 def test_name_parsing(self):
     "Parser should split full candidate name into first and last names"
     path = join(dirname(__file__), 'sample_results.csv')
     results = parse_and_clean(path)
     race = results['President']
     smith = [cand for cand in race.candidates.values() if cand.last_name == 'Smith'][0]
     self.assertEqual(smith.first_name, 'Joe')
     self.assertEqual(smith.last_name, 'Smith')
Esempio n. 4
0
 def test_name_parsing(self):
     "Parser should split full candidate name into first and last names"
     path = join(dirname(__file__), 'sample_results.csv')
     results = parse_and_clean(path)
     race = results['President']
     smith = [
         cand for cand in race.candidates.values()
         if cand.last_name == 'Smith'
     ][0]
     self.assertEqual(smith.first_name, 'Joe')
     self.assertEqual(smith.last_name, 'Smith')