Skip to content

Commit 094d71b

Browse files
committed
Test series reading
1 parent 5734f72 commit 094d71b

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
- Added testing infrastructure (pytest, GitHub Action).
1212

13+
- Added tests for series reading.
14+
1315
- Added ruff as a development dependency.
1416

1517

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""
2+
:Copyright: 2024 Jochen Kupperschmidt
3+
:License: MIT
4+
"""
5+
6+
import pytest
7+
8+
from lanpartydb.models import Series
9+
from lanpartydb.reading import read_series_list_from_toml
10+
11+
12+
@pytest.mark.parametrize(
13+
('toml', 'expected'),
14+
[
15+
(
16+
"""
17+
""",
18+
[],
19+
),
20+
(
21+
"""
22+
[[series]]
23+
slug = "megalan"
24+
name = "MegaLAN"
25+
""",
26+
[
27+
Series(
28+
slug='megalan',
29+
name='MegaLAN',
30+
),
31+
],
32+
),
33+
(
34+
"""
35+
[[series]]
36+
slug = "gammalan"
37+
name = "GammaLAN"
38+
country_codes = ["ca", "us"]
39+
40+
[[series]]
41+
slug = "deltalan"
42+
name = "DeltaLAN"
43+
alternative_names = ["Δ LAN", "Δέλτα LAN"]
44+
country_codes = ["au"]
45+
""",
46+
[
47+
Series(
48+
slug='gammalan',
49+
name='GammaLAN',
50+
alternative_names=[],
51+
country_codes=['ca', 'us'],
52+
),
53+
Series(
54+
slug='deltalan',
55+
name='DeltaLAN',
56+
alternative_names=['Δ LAN', 'Δέλτα LAN'],
57+
country_codes=['au'],
58+
),
59+
],
60+
),
61+
],
62+
)
63+
def test_read_series_list_from_toml(toml: str, expected: list[Series]):
64+
assert read_series_list_from_toml(toml) == expected

0 commit comments

Comments
 (0)