Commit 5f4a1124 authored by Marius Kriegerowski's avatar Marius Kriegerowski
Browse files

fix tests

parent 6b072fa5
......@@ -19,7 +19,6 @@
from __future__ import annotations
import logging
import csv
from typing import Optional
from rabotnik import Rule
from rabotnik.storages.base import StorageBase
......@@ -52,7 +51,7 @@ class OverridingOccupancy:
for candidate in self.mapping.keys():
if candidate in occupancies.tags:
raise TagResult(GEMTag(candidate))
raise TagResult(candidate)
def from_csv(cls, fn: str) -> OverridingOccupancy:
......@@ -61,6 +60,8 @@ class OverridingOccupancy:
with open(fn) as csvfile:
occupancy_mapping = {k.strip(): v.strip() for (k, v) in csv.reader(csvfile)}
occupancy_mapping = {GEMTag.from_string(k): v for k, v in occupancy_mapping.items()}
return cls(mapping=occupancy_mapping)
......@@ -48,8 +48,12 @@ async def test_rule_get_building_occupancy(storage_consumer, building_poi_mapper
def test_overriding_occupancy(overriding_occupancies):
"""Rule #1"""
demo_tags = TagStatistics.from_strings(["ASS1", "COM10"])
occupancy = overriding_occupancies.apply(demo_tags)
assert occupancy == "COM10"
occupancy = overriding_occupancies.apply(demo_tags)
except TagResult as e:
occupancy = e.tag
assert occupancy == GEMTag.from_string("COM10")
def test_overriding_occupancy_unknown(overriding_occupancies):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment