Skip to content

Commit d89a06c

Browse files
dicksontsairushilpatel0
authored andcommitted
Add changelog and changelog format check (anthropics#77)
Signed-off-by: Rushil Patel <rpatel@codegen.com>
1 parent b8fbe03 commit d89a06c

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changelog
2+
3+
## 0.0.16
4+
5+
- Introduce ClaudeSDKClient for bidirectional streaming conversation
6+
- Support Message input, not just string prompts, in query()
7+
- Raise explicit error if the cwd does not exist
8+
9+
## 0.0.14
10+
11+
- Add safety limits to Claude Code CLI stderr reading
12+
- Improve handling of output JSON messages split across multiple stream reads
13+
14+
## 0.0.13
15+
16+
- Update MCP (Model Context Protocol) types to align with Claude Code expectations
17+
- Fix multi-line buffering issue
18+
- Rename cost_usd to total_cost_usd in API responses
19+
- Fix optional cost fields handling
20+

tests/test_changelog.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import re
2+
from pathlib import Path
3+
4+
5+
class TestChangelog:
6+
def setup_method(self):
7+
self.changelog_path = Path(__file__).parent.parent / "CHANGELOG.md"
8+
9+
def test_changelog_exists(self):
10+
assert self.changelog_path.exists(), "CHANGELOG.md file should exist"
11+
12+
def test_changelog_starts_with_header(self):
13+
content = self.changelog_path.read_text()
14+
assert content.startswith("# Changelog"), (
15+
"Changelog should start with '# Changelog'"
16+
)
17+
18+
def test_changelog_has_valid_version_format(self):
19+
content = self.changelog_path.read_text()
20+
lines = content.split("\n")
21+
22+
version_pattern = re.compile(r"^## \d+\.\d+\.\d+(?:\s+\(\d{4}-\d{2}-\d{2}\))?$")
23+
versions = []
24+
25+
for line in lines:
26+
if line.startswith("## "):
27+
assert version_pattern.match(line), f"Invalid version format: {line}"
28+
version_match = re.match(r"^## (\d+\.\d+\.\d+)", line)
29+
if version_match:
30+
versions.append(version_match.group(1))
31+
32+
assert len(versions) > 0, "Changelog should contain at least one version"
33+
34+
def test_changelog_has_bullet_points(self):
35+
content = self.changelog_path.read_text()
36+
lines = content.split("\n")
37+
38+
in_version_section = False
39+
has_bullet_points = False
40+
41+
for i, line in enumerate(lines):
42+
if line.startswith("## "):
43+
if in_version_section and not has_bullet_points:
44+
raise AssertionError(
45+
"Previous version section should have at least one bullet point"
46+
)
47+
in_version_section = True
48+
has_bullet_points = False
49+
elif in_version_section and line.startswith("- "):
50+
has_bullet_points = True
51+
elif in_version_section and line.strip() == "" and i == len(lines) - 1:
52+
# Last line check
53+
assert has_bullet_points, (
54+
"Each version should have at least one bullet point"
55+
)
56+
57+
# Check the last section
58+
if in_version_section:
59+
assert has_bullet_points, (
60+
"Last version section should have at least one bullet point"
61+
)
62+
63+
def test_changelog_versions_in_descending_order(self):
64+
content = self.changelog_path.read_text()
65+
lines = content.split("\n")
66+
67+
versions = []
68+
for line in lines:
69+
if line.startswith("## "):
70+
version_match = re.match(r"^## (\d+)\.(\d+)\.(\d+)", line)
71+
if version_match:
72+
versions.append(tuple(map(int, version_match.groups())))
73+
74+
for i in range(1, len(versions)):
75+
assert versions[i - 1] > versions[i], (
76+
f"Versions should be in descending order: {versions[i - 1]} should be > {versions[i]}"
77+
)
78+
79+
def test_changelog_no_empty_bullet_points(self):
80+
content = self.changelog_path.read_text()
81+
lines = content.split("\n")
82+
83+
for line in lines:
84+
if line.strip() == "-":
85+
raise AssertionError("Changelog should not have empty bullet points")

0 commit comments

Comments
 (0)