@@ -189,7 +189,7 @@ async def test_delete_note_doesnt_exist(app):
189189@pytest .mark .asyncio
190190async def test_write_note_with_tag_array_from_bug_report (app ):
191191 """Test creating a note with a tag array as reported in issue #38.
192-
192+
193193 This reproduces the exact payload from the bug report where Cursor
194194 was passing an array of tags and getting a type mismatch error.
195195 """
@@ -198,12 +198,12 @@ async def test_write_note_with_tag_array_from_bug_report(app):
198198 "title" : "Title" ,
199199 "folder" : "folder" ,
200200 "content" : "CONTENT" ,
201- "tags" : ["hipporag" , "search" , "fallback" , "symfony" , "error-handling" ]
201+ "tags" : ["hipporag" , "search" , "fallback" , "symfony" , "error-handling" ],
202202 }
203-
203+
204204 # Try to call the function with this data directly
205205 result = await write_note (** bug_payload )
206-
206+
207207 assert result
208208 assert "permalink: folder/title" in result
209209 assert "Tags" in result
@@ -257,10 +257,10 @@ async def test_write_note_verbose(app):
257257@pytest .mark .asyncio
258258async def test_write_note_preserves_custom_metadata (app , test_config ):
259259 """Test that updating a note preserves custom metadata fields.
260-
260+
261261 Reproduces issue #36 where custom frontmatter fields like Status
262262 were being lost when updating notes with the write_note tool.
263-
263+
264264 Should:
265265 - Create a note with custom frontmatter
266266 - Update the note with new content
@@ -273,51 +273,50 @@ async def test_write_note_preserves_custom_metadata(app, test_config):
273273 content = "# Initial content" ,
274274 tags = ["test" ],
275275 )
276-
276+
277277 # Read the note to get its permalink
278278 content = await read_note ("test/custom-metadata-note" )
279-
279+
280280 # Now directly update the file with custom frontmatter
281281 # We need to use a direct file update to add custom frontmatter
282- from pathlib import Path
283282 import frontmatter
284-
283+
285284 file_path = test_config .home / "test" / "Custom Metadata Note.md"
286285 post = frontmatter .load (file_path )
287286
288287 # Add custom frontmatter
289288 post ["Status" ] = "In Progress"
290289 post ["Priority" ] = "High"
291290 post ["Version" ] = "1.0"
292-
291+
293292 # Write the file back
294293 with open (file_path , "w" ) as f :
295294 f .write (frontmatter .dumps (post ))
296-
295+
297296 # Now update the note using write_note
298297 result = await write_note (
299298 title = "Custom Metadata Note" ,
300299 folder = "test" ,
301300 content = "# Updated content" ,
302301 tags = ["test" , "updated" ],
303302 )
304-
303+
305304 # Verify the update was successful
306305 assert "Updated test/Custom Metadata Note.md" in result
307-
306+
308307 # Read the note back and check if custom frontmatter is preserved
309308 content = await read_note ("test/custom-metadata-note" )
310-
309+
311310 # Custom frontmatter should be preserved
312311 assert "Status: In Progress" in content
313312 assert "Priority: High" in content
314313 # Version might be quoted as '1.0' due to YAML serialization
315314 assert "Version:" in content # Just check that the field exists
316- assert "1.0" in content # And that the value exists somewhere
317-
315+ assert "1.0" in content # And that the value exists somewhere
316+
318317 # And new content should be there
319318 assert "# Updated content" in content
320-
319+
321320 # And tags should be updated
322321 assert "'#test'" in content
323- assert "'#updated'" in content
322+ assert "'#updated'" in content
0 commit comments