Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Function match_headers causes election majorz import error #29

Open
gh-PonyM opened this issue Aug 6, 2019 · 0 comments
Open

Function match_headers causes election majorz import error #29

gh-PonyM opened this issue Aug 6, 2019 · 0 comments
Assignees

Comments

@gh-PonyM
Copy link

gh-PonyM commented Aug 6, 2019

While the fixture wabstic_majorz.tar.gz passes the tests, a new test data set sent by DeRochi raises "Missing Column: gewahlt" for wm_kandidaten csv file. The two sample files have exactly the same column names.

Test to append to test_match_headers_missing to reproduce:

raw_headers = ['SortGeschaeft', 'KNR', 'Nachname', 'Vorname', 'Partei',
               'Beruf', 'Titel', 'Wohnort', 'Jahrgang', 'Bisher',
               'Gewaehlt', 'StimmenProz']
headers = [normalize_header(h) for h in raw_headers]
assert match_headers(
    headers,
    expected=('sortgeschaeft', 'knr', 'nachname', 'vorname', 'partei',
              'beruf', 'titel', 'wohnort', 'jahrgang', 'gewahlt')) \
    == ['sortgeschaeft', 'knr', 'nachname', 'vorname', 'partei', 'beruf',
        'titel', 'wohnort', 'jahrgang', 'gewahlt']

The function also returns more headers then the expected ones:

raw_headers` = ['SortGeschaeft', 'KNR', 'Nachname', 'Vorname', 'Partei',
               'Beruf', 'Titel', 'Wohnort', 'Jahrgang', 'Bisher',
               'Gewaehlt', 'StimmenProz']
headers = [normalize_header(h) for h in raw_headers]
print(headers)
assert match_headers(
    headers,
    expected=('knr', 'gewahlt')) \
    == ['knr', 'gewahlt']

The test test_match_headers_order can also be extended with this example, that should pass:

matches = match_headers(['fl', 'tl', 'hoch', 'tief', 'heute', 'morgen'],
                        expected=('hoch', 'fl', 'morgen'))
assert matches == ['fl', 'hoch', 'morgen']
@gh-PonyM gh-PonyM assigned gh-PonyM and href and unassigned gh-PonyM Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants