Skip to content

Commit

Permalink
update nuts processor because of changes in cellar
Browse files Browse the repository at this point in the history
  • Loading branch information
duprijil committed Oct 25, 2023
1 parent e76a09c commit 0f32f5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ted_data_eu/adapters/nuts_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def __init__(self, nuts_csv: io.StringIO):
}
)
self.dataframe[self.NUTS_PARENT_COLUMN_NAME] = self.dataframe[self.NUTS_PARENT_COLUMN_NAME].str.split("/").str[-1]
self.dataframe[self.NUTS_LABEL_COLUMN_NAME] = self.dataframe[self.NUTS_LABEL_COLUMN_NAME].str.partition(" ")[2]

def nuts_exists(self, nuts_code: str) -> bool:
"""
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_nuts_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ def test_cellar_nuts_processor(real_nuts, fake_nuts, cellar_nuts_processor):
assert cellar_nuts_processor.get_nuts_level_by_code(nuts_code='FRK') == 1
assert cellar_nuts_processor.get_nuts_level_by_code(nuts_code='FR') == 0
assert cellar_nuts_processor.get_nuts_level_by_code(nuts_code='F') is None
assert cellar_nuts_processor.get_nuts_level_by_code(nuts_code=None) is None
assert cellar_nuts_processor.get_nuts_level_by_code(nuts_code=None) is None

assert cellar_nuts_processor.get_nuts_label_by_code(nuts_code='BE32') == 'Prov. Hainaut'

0 comments on commit 0f32f5e

Please sign in to comment.