all is well
This commit is contained in:
parent
eac1bd0d13
commit
2f149503bb
53 changed files with 1543 additions and 354 deletions
|
|
@ -15,7 +15,7 @@ def test_transform_grocery_retail_points_outputs_chain_categories():
|
|||
}
|
||||
)
|
||||
|
||||
pois = transform_grocery_retail_points(raw)
|
||||
pois = transform_grocery_retail_points(raw, min_chain_locations=1)
|
||||
|
||||
assert pois.select(
|
||||
"id", "name", "category", "icon_category", "group", "emoji"
|
||||
|
|
@ -69,7 +69,7 @@ def test_transform_grocery_retail_points_keeps_fascia_icon_category():
|
|||
}
|
||||
)
|
||||
|
||||
pois = transform_grocery_retail_points(raw)
|
||||
pois = transform_grocery_retail_points(raw, min_chain_locations=1)
|
||||
|
||||
assert pois.select("category", "icon_category").to_dicts() == [
|
||||
{"category": "Tesco", "icon_category": "Tesco Express"},
|
||||
|
|
@ -96,7 +96,7 @@ def test_transform_grocery_retail_points_accepts_base_fascias():
|
|||
}
|
||||
)
|
||||
|
||||
pois = transform_grocery_retail_points(raw)
|
||||
pois = transform_grocery_retail_points(raw, min_chain_locations=1)
|
||||
|
||||
assert pois.select("category", "icon_category").to_dicts() == [
|
||||
{"category": "Aldi", "icon_category": "Aldi"},
|
||||
|
|
@ -118,6 +118,29 @@ def test_transform_grocery_retail_points_drops_invalid_rows():
|
|||
}
|
||||
)
|
||||
|
||||
pois = transform_grocery_retail_points(raw)
|
||||
pois = transform_grocery_retail_points(raw, min_chain_locations=1)
|
||||
|
||||
assert pois["category"].to_list() == ["Waitrose"]
|
||||
|
||||
|
||||
def test_transform_grocery_retail_points_includes_unmapped_chains_with_five_locations():
|
||||
raw = pl.DataFrame(
|
||||
{
|
||||
"id": list(range(1, 10)),
|
||||
"retailer": ["Tian Tian"] * 5 + ["Corner Shop"] * 4,
|
||||
"fascia": ["Tian Tian Market"] * 5 + ["Corner Shop"] * 4,
|
||||
"store_name": [f"Store {i}" for i in range(1, 10)],
|
||||
"long_wgs": [-0.1] * 9,
|
||||
"lat_wgs": [51.5] * 9,
|
||||
}
|
||||
)
|
||||
|
||||
pois = transform_grocery_retail_points(raw)
|
||||
|
||||
assert pois.select("id", "category", "icon_category").to_dicts() == [
|
||||
{"id": "glx-1", "category": "Tian Tian", "icon_category": "Tian Tian"},
|
||||
{"id": "glx-2", "category": "Tian Tian", "icon_category": "Tian Tian"},
|
||||
{"id": "glx-3", "category": "Tian Tian", "icon_category": "Tian Tian"},
|
||||
{"id": "glx-4", "category": "Tian Tian", "icon_category": "Tian Tian"},
|
||||
{"id": "glx-5", "category": "Tian Tian", "icon_category": "Tian Tian"},
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue