Ejemplo n.º 1
0
def test_precincts_file_missing_column():
    precint_file = os.path.join(data_dir, 'precincts_missing_nb.txt')
    election_file = os.path.join(data_dir, 'elections', 'sen10.csv')
    plan_file = os.path.join(data_dir, 'plans', '2011.csv')
    with pytest.raises(ValueError):
        models.load_files_into_dataframe(precint_file, election_file,
                                         plan_file)
Ejemplo n.º 2
0
def test_load_precint_file_with_wrong_rows():
    precint_file = os.path.join(data_dir, 'precincts.txt')
    election_file = os.path.join(data_dir, 'elections', 'sen10.csv')
    plan_file = os.path.join(data_dir, 'plans', '2011_missing_row.csv')

    with pytest.raises(ValueError):
        models.load_files_into_dataframe(precint_file, election_file,
                                         plan_file)
Ejemplo n.º 3
0
def test_load_precint_file_with_header():
    precint_file = os.path.join(data_dir, 'precincts.txt')
    election_file = os.path.join(data_dir, 'elections', 'sen10.csv')
    plan_file = os.path.join(data_dir, 'plans', '2011_header.csv')
    df = models.load_files_into_dataframe(precint_file, election_file,
                                          plan_file)
    assert len(df) == 9059