Skip to content

Commit c17db7a

Browse files
committed
Tests
1 parent 65f3a49 commit c17db7a

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

build_docs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def from_json(cls, data: dict) -> Versions:
116116
f"expected to be one of {permitted}."
117117
)
118118
raise ValueError(msg)
119-
versions.append(Version(name=name, branch_or_tag=branch, status=status))
119+
versions.append(Version(name=name, status=status, branch_or_tag=branch))
120120

121121
return cls(sorted(versions, key=Version.as_tuple))
122122

@@ -159,8 +159,8 @@ class Version:
159159
"""Represents a CPython version and its documentation build dependencies."""
160160

161161
name: str
162-
branch_or_tag: str | None
163162
status: str
163+
branch_or_tag: str
164164

165165
STATUSES = {"EOL", "security-fixes", "stable", "pre-release", "in development"}
166166

tests/test_build_docs_versions.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,59 @@
44
def test_filter_default() -> None:
55
# Arrange
66
versions = Versions([
7-
Version("3.14", status="feature"),
8-
Version("3.13", status="bugfix"),
9-
Version("3.12", status="bugfix"),
10-
Version("3.11", status="security"),
11-
Version("3.10", status="security"),
12-
Version("3.9", status="security"),
7+
Version(name="3.14", status="feature", branch_or_tag=""),
8+
Version(name="3.13", status="bugfix", branch_or_tag=""),
9+
Version(name="3.12", status="bugfix", branch_or_tag=""),
10+
Version(name="3.11", status="security", branch_or_tag=""),
11+
Version(name="3.10", status="security", branch_or_tag=""),
12+
Version(name="3.9", status="security", branch_or_tag=""),
1313
])
1414

1515
# Act
1616
filtered = versions.filter()
1717

1818
# Assert
1919
assert filtered == [
20-
Version("3.14", status="feature"),
21-
Version("3.13", status="bugfix"),
22-
Version("3.12", status="bugfix"),
20+
Version(name="3.14", status="feature", branch_or_tag=""),
21+
Version(name="3.13", status="bugfix", branch_or_tag=""),
22+
Version(name="3.12", status="bugfix", branch_or_tag=""),
2323
]
2424

2525

2626
def test_filter_one() -> None:
2727
# Arrange
2828
versions = Versions([
29-
Version("3.14", status="feature"),
30-
Version("3.13", status="bugfix"),
31-
Version("3.12", status="bugfix"),
32-
Version("3.11", status="security"),
33-
Version("3.10", status="security"),
34-
Version("3.9", status="security"),
29+
Version(name="3.14", status="feature", branch_or_tag=""),
30+
Version(name="3.13", status="bugfix", branch_or_tag=""),
31+
Version(name="3.12", status="bugfix", branch_or_tag=""),
32+
Version(name="3.11", status="security", branch_or_tag=""),
33+
Version(name="3.10", status="security", branch_or_tag=""),
34+
Version(name="3.9", status="security", branch_or_tag=""),
3535
])
3636

3737
# Act
3838
filtered = versions.filter(["3.13"])
3939

4040
# Assert
41-
assert filtered == [Version("3.13", status="security")]
41+
assert filtered == [Version(name="3.13", status="security", branch_or_tag="")]
4242

4343

4444
def test_filter_multiple() -> None:
4545
# Arrange
4646
versions = Versions([
47-
Version("3.14", status="feature"),
48-
Version("3.13", status="bugfix"),
49-
Version("3.12", status="bugfix"),
50-
Version("3.11", status="security"),
51-
Version("3.10", status="security"),
52-
Version("3.9", status="security"),
47+
Version(name="3.14", status="feature", branch_or_tag=""),
48+
Version(name="3.13", status="bugfix", branch_or_tag=""),
49+
Version(name="3.12", status="bugfix", branch_or_tag=""),
50+
Version(name="3.11", status="security", branch_or_tag=""),
51+
Version(name="3.10", status="security", branch_or_tag=""),
52+
Version(name="3.9", status="security", branch_or_tag=""),
5353
])
5454

5555
# Act
5656
filtered = versions.filter(["3.13", "3.14"])
5757

5858
# Assert
5959
assert filtered == [
60-
Version("3.14", status="feature"),
61-
Version("3.13", status="security"),
60+
Version(name="3.14", status="feature", branch_or_tag=""),
61+
Version(name="3.13", status="security", branch_or_tag=""),
6262
]

0 commit comments

Comments
 (0)