Skip to content

Commit 367dc69

Browse files
phernandezclaude
andcommitted
style: apply ruff formatting to test files
Auto-format test files for permalink collision tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent ee18eb2 commit 367dc69

2 files changed

Lines changed: 33 additions & 24 deletions

File tree

tests/mcp/test_permalink_collision_file_overwrite.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,18 @@ async def test_permalink_collision_should_not_overwrite_different_file(app, test
8989
# This is where the bug manifests - Node A.md gets overwritten with Node C content
9090
content_a_after = await read_note.fn("edge-cases/node-a", project=test_project.name)
9191
assert "Node A" in content_a_after, "Node A title should still be 'Node A'"
92-
assert "Original content for Node A" in content_a_after, \
92+
assert "Original content for Node A" in content_a_after, (
9393
"Node A file should NOT be overwritten by Node C creation"
94-
assert "Content for Node C" not in content_a_after, \
95-
"Node A should NOT contain Node C's content"
94+
)
95+
assert "Content for Node C" not in content_a_after, "Node A should NOT contain Node C's content"
9696

9797
# Verify Node C has its own content
9898
content_c = await read_note.fn("edge-cases/node-c", project=test_project.name)
9999
assert "Node C" in content_c
100100
assert "Content for Node C" in content_c
101-
assert "Original content for Node A" not in content_c, \
101+
assert "Original content for Node A" not in content_c, (
102102
"Node C should not contain Node A's content"
103+
)
103104

104105
# Verify files physically exist with correct content
105106
project_path = Path(test_project.path)
@@ -113,17 +114,18 @@ async def test_permalink_collision_should_not_overwrite_different_file(app, test
113114
node_a_file_content = node_a_file.read_text()
114115
node_c_file_content = node_c_file.read_text()
115116

116-
assert "Node A" in node_a_file_content, \
117-
"Physical file Node A.md should contain Node A title"
118-
assert "Original content for Node A" in node_a_file_content, \
117+
assert "Node A" in node_a_file_content, "Physical file Node A.md should contain Node A title"
118+
assert "Original content for Node A" in node_a_file_content, (
119119
"Physical file Node A.md should contain original Node A content"
120-
assert "Content for Node C" not in node_a_file_content, \
120+
)
121+
assert "Content for Node C" not in node_a_file_content, (
121122
"Physical file Node A.md should NOT contain Node C content"
123+
)
122124

123-
assert "Node C" in node_c_file_content, \
124-
"Physical file Node C.md should contain Node C title"
125-
assert "Content for Node C" in node_c_file_content, \
125+
assert "Node C" in node_c_file_content, "Physical file Node C.md should contain Node C title"
126+
assert "Content for Node C" in node_c_file_content, (
126127
"Physical file Node C.md should contain Node C content"
128+
)
127129

128130

129131
@pytest.mark.asyncio
@@ -161,12 +163,14 @@ async def test_notes_with_similar_titles_maintain_separate_files(app, test_proje
161163

162164
# Verify each note can be read back with its own content
163165
content = await read_note.fn(permalink, project=test_project.name)
164-
assert f"Unique content for {title}" in content, \
166+
assert f"Unique content for {title}" in content, (
165167
f"Note with title '{title}' should maintain its unique content"
168+
)
166169

167170
# Verify all created permalinks are tracked
168-
assert len(created_permalinks) == len(titles_and_folders), \
171+
assert len(created_permalinks) == len(titles_and_folders), (
169172
"All notes should be created successfully"
173+
)
170174

171175

172176
@pytest.mark.asyncio
@@ -202,8 +206,9 @@ async def test_sequential_note_creation_preserves_all_files(app, test_project):
202206
content = await read_note.fn(permalink, project=test_project.name)
203207

204208
assert title in content, f"Note '{title}' should still have its title"
205-
assert expected_content.split("\n\n")[1] in content, \
209+
assert expected_content.split("\n\n")[1] in content, (
206210
f"Note '{title}' should still have its original content"
211+
)
207212

208213
# Verify physical files exist
209214
project_path = Path(test_project.path)
@@ -214,8 +219,7 @@ async def test_sequential_note_creation_preserves_all_files(app, test_project):
214219
assert file_path.exists(), f"File for '{title}' should exist"
215220

216221
file_content = file_path.read_text()
217-
assert title in file_content, \
218-
f"Physical file for '{title}' should contain correct title"
222+
assert title in file_content, f"Physical file for '{title}' should contain correct title"
219223

220224

221225
@pytest.mark.asyncio
@@ -329,14 +333,16 @@ async def test_sync_permalink_collision_file_overwrite_bug(
329333
node_a_after_sync = node_a_file.read_text()
330334

331335
# The bug: Node A.md contains Node C content instead of Node A content
332-
assert "title: Node A" in node_a_after_sync, \
336+
assert "title: Node A" in node_a_after_sync, (
333337
"Node A.md file should still have title: Node A in frontmatter"
334-
assert "Node A" in node_a_after_sync, \
335-
"Node A.md file should still contain 'Node A' title"
336-
assert "Original content for Node A" in node_a_after_sync, \
338+
)
339+
assert "Node A" in node_a_after_sync, "Node A.md file should still contain 'Node A' title"
340+
assert "Original content for Node A" in node_a_after_sync, (
337341
f"Node A.md file should NOT be overwritten! Content: {node_a_after_sync[:200]}"
338-
assert "Content for Node C" not in node_a_after_sync, \
342+
)
343+
assert "Content for Node C" not in node_a_after_sync, (
339344
f"Node A.md should NOT contain Node C content! Content: {node_a_after_sync[:200]}"
345+
)
340346

341347
# Verify Node C file exists with correct content
342348
assert node_c_file.exists(), "Node C.md file should exist"

tests/services/test_entity_service.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,14 +1876,17 @@ async def test_create_or_update_entity_fuzzy_search_bug(
18761876
# Re-read Node A file to ensure it wasn't overwritten
18771877
content_a_after = file_a.read_text()
18781878
assert "title: Node A" in content_a_after, "Node A.md should still have Node A title"
1879-
assert "Original content for Node A" in content_a_after, \
1879+
assert "Original content for Node A" in content_a_after, (
18801880
"Node A.md should NOT be overwritten with Node C content"
1881-
assert "Content for Node C" not in content_a_after, \
1881+
)
1882+
assert "Content for Node C" not in content_a_after, (
18821883
"Node A.md should not contain Node C content"
1884+
)
18831885

18841886
# Verify Node C file has correct content
18851887
content_c = file_c.read_text()
18861888
assert "title: Node C" in content_c, "Node C.md should have Node C title"
18871889
assert "Content for Node C" in content_c, "Node C.md should have Node C content"
1888-
assert "Original content for Node A" not in content_c, \
1890+
assert "Original content for Node A" not in content_c, (
18891891
"Node C.md should not contain Node A content"
1892+
)

0 commit comments

Comments
 (0)