Skip to content

Commit 3773ea5

Browse files
committed
V2.1.0 Make category OnlyList as per spec
Closes #50
1 parent a75867b commit 3773ea5

File tree

9 files changed

+168
-4
lines changed

9 files changed

+168
-4
lines changed

poetry.lock

Lines changed: 165 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pre-commit = "^2.12.0"
4949
ruff = "*"
5050
rich = "*"
5151
pytest = "^7.4.0"
52+
requests = "^2.32.3"
5253

5354
[tool.pytest.ini_options]
5455
addopts = "--color=yes"

rss_parser/models/rss/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class OptionalChannelElementsMixin(XMLBaseModel):
4747
last_build_date: Optional[Tag[DateTimeOrStr]] = None # Sat, 07 Sep 2002 09:42:31 GMT
4848
"The last time the content of the channel changed."
4949

50-
category: Optional[Tag[str]] = None # Newspapers
50+
categories: Optional[OnlyList[Tag[str]]] = pydantic.Field(alias="category", default=[])
5151
"Specify one or more categories that the channel belongs to. Follows the same rules as the <item.py>-level " "category element." # noqa
5252

5353
generator: Optional[Tag[str]] = None # MightyInHouse Content System v2.3

rss_parser/models/rss/item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class OptionalItemElementsMixin(XMLBaseModel):
2626
author: Optional[Tag[str]] = None
2727
"Email address of the author of the item."
2828

29-
category: Optional[Tag[str]] = None
29+
categories: Optional[OnlyList[Tag[str]]] = pydantic.Field(alias="category", default=[])
3030
"Includes the item in one or more categories."
3131

3232
comments: Optional[Tag[str]] = None

tests/samples/apology_line/result.pkl

5 Bytes
Binary file not shown.

tests/samples/github-49/result.pkl

93 Bytes
Binary file not shown.

tests/samples/rss_2/result.pkl

32 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)