mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
Add tests
This commit is contained in:
parent
c8b2954ef3
commit
43a207522a
1 changed files with 13 additions and 2 deletions
|
@ -1,7 +1,18 @@
|
||||||
from custom_components.irm_kmi.pollen import PollenParser
|
from custom_components.irm_kmi.pollen import PollenParser
|
||||||
|
|
||||||
|
|
||||||
def test_svg_pollen_parsing():
|
def test_svg_pollen_parsing():
|
||||||
# TODO make it an actual test
|
|
||||||
with open("tests/fixtures/pollen.svg", "r") as file:
|
with open("tests/fixtures/pollen.svg", "r") as file:
|
||||||
svg_data = file.read()
|
svg_data = file.read()
|
||||||
PollenParser(svg_data).get_pollen_data()
|
data = PollenParser(svg_data).get_pollen_data()
|
||||||
|
assert data == {'birch': 'purple', 'oak': 'active', 'hazel': 'none', 'mugwort': 'none', 'alder': 'green',
|
||||||
|
'grasses': 'none', 'ash': 'active'}
|
||||||
|
|
||||||
|
|
||||||
|
def test_pollen_options():
|
||||||
|
assert PollenParser.get_option_values() == ['active', 'green', 'yellow', 'orange', 'red', 'purple', 'none']
|
||||||
|
|
||||||
|
|
||||||
|
def test_pollen_default_values():
|
||||||
|
assert PollenParser.get_default_data() == {'birch': 'none', 'oak': 'none', 'hazel': 'none', 'mugwort': 'none',
|
||||||
|
'alder': 'none', 'grasses': 'none', 'ash': 'none'}
|
||||||
|
|
Loading…
Add table
Reference in a new issue