From 686ee62df67d4d3aa37d8761b2a571f2eda2d9bc Mon Sep 17 00:00:00 2001 From: Jules Dejaeghere Date: Wed, 3 Apr 2024 11:29:28 +0200 Subject: [PATCH] Add test for SVG parsing --- tests/fixtures/pollen_three.svg | 45 ++++++++++++++++++++++++++++++++- tests/test_pollen.py | 5 ++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/pollen_three.svg b/tests/fixtures/pollen_three.svg index 4bfe1b6..04db508 100644 --- a/tests/fixtures/pollen_three.svg +++ b/tests/fixtures/pollen_three.svg @@ -1,2 +1,45 @@ - Active pollen Alder activeAsh activeOak active Birch \ No newline at end of file + + + + + + + + + + + + + Active pollen + + + Alder + active + Ash + active + Oak + active + + \ No newline at end of file diff --git a/tests/test_pollen.py b/tests/test_pollen.py index b53f2b9..667ca1c 100644 --- a/tests/test_pollen.py +++ b/tests/test_pollen.py @@ -21,6 +21,11 @@ def test_svg_pollen_parsing(): assert data == {'birch': 'purple', 'oak': 'active', 'hazel': 'none', 'mugwort': 'none', 'alder': 'active', 'grasses': 'none', 'ash': 'active'} + with open("tests/fixtures/pollen_three.svg", "r") as file: + svg_data = file.read() + data = PollenParser(svg_data).get_pollen_data() + assert data == {'birch': 'none', 'oak': 'active', 'hazel': 'none', 'mugwort': 'none', 'alder': 'active', + 'grasses': 'none', 'ash': 'active'} def test_pollen_options(): assert PollenParser.get_option_values() == ['active', 'green', 'yellow', 'orange', 'red', 'purple', 'none']