@@ -320,7 +320,7 @@ async def test_get_connection_settings_format(self, server):
320320
321321class TestIssue16GetDocumentsJsonSerialization :
322322 """Test for issue #16 - get-documents should return JSON, not Python object representations"""
323-
323+
324324 @pytest .fixture
325325 async def server (self ):
326326 """Create server instance for issue #16 tests"""
@@ -333,45 +333,52 @@ async def server(self):
333333 async def test_get_documents_returns_json_not_python_object (self , server ):
334334 """Test that get-documents returns JSON-formatted text, not Python object string representation (issue #16)"""
335335 import time
336+
336337 test_index = f"test_issue16_{ int (time .time () * 1000 )} "
337-
338+
338339 # Create index and add a test document
339340 await simulate_mcp_call (server , "create-index" , {"uid" : test_index })
340-
341+
341342 test_document = {"id" : 1 , "title" : "Test Document" , "content" : "Test content" }
342- await simulate_mcp_call (server , "add-documents" , {
343- "indexUid" : test_index ,
344- "documents" : [test_document ]
345- })
346-
343+ await simulate_mcp_call (
344+ server ,
345+ "add-documents" ,
346+ {"indexUid" : test_index , "documents" : [test_document ]},
347+ )
348+
347349 # Wait for indexing
348350 import asyncio
351+
349352 await asyncio .sleep (0.5 )
350-
353+
351354 # Get documents with explicit parameters
352- result = await simulate_mcp_call (server , "get-documents" , {
353- "indexUid" : test_index ,
354- "offset" : 0 ,
355- "limit" : 10
356- })
357-
355+ result = await simulate_mcp_call (
356+ server , "get-documents" , {"indexUid" : test_index , "offset" : 0 , "limit" : 10 }
357+ )
358+
358359 assert len (result ) == 1
359360 assert result [0 ].type == "text"
360-
361+
361362 response_text = result [0 ].text
362-
363+
363364 # Issue #16 assertion: Should NOT contain Python object representation
364- assert "<meilisearch.models.document.DocumentsResults object at" not in response_text
365+ assert (
366+ "<meilisearch.models.document.DocumentsResults object at"
367+ not in response_text
368+ )
365369 assert "DocumentsResults" not in response_text
366-
370+
367371 # Should contain proper JSON structure
368372 assert "Documents:" in response_text
369- assert "Test Document" in response_text # Actual document content should be accessible
373+ assert (
374+ "Test Document" in response_text
375+ ) # Actual document content should be accessible
370376 assert "Test content" in response_text
371-
377+
372378 # Should be valid JSON after the "Documents:" prefix
373379 json_part = response_text .replace ("Documents:" , "" ).strip ()
374380 import json
381+
375382 try :
376383 parsed_data = json .loads (json_part )
377384 assert isinstance (parsed_data , dict )
0 commit comments