MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / test_performance_operations

Method test_performance_operations

tests/test_faiss.py:359–397  ·  view source on GitHub ↗

Test performance-related operations.

(self)

Source from the content-addressed store, hash-verified

357 "Search completed")
358
359 async def test_performance_operations(self):
360 """Test performance-related operations."""
361 print("\n=== Testing Performance Operations ===")
362
363 # Test adding many documents
364 texts = [f"This is test document number {i} for performance testing." for i in range(50)]
365 metadatas = [{"batch": "performance", "index": i} for i in range(50)]
366
367 request = FaissAddRequest(texts=texts, metadatas=metadatas)
368 result = await self.faiss_service.add_documents(request)
369
370 self.assert_test(result.count == 50,
371 "Add many documents",
372 f"Expected count=50, got count={result.count}")
373
374 # Test search performance
375 request = FaissSearchRequest(
376 query="performance testing",
377 k=10,
378 fetch_k=100
379 )
380 result = await self.faiss_service.search_similar(request)
381
382 self.assert_test(True,
383 "Search performance test",
384 "Search completed")
385
386 # Test batch deletion (use some test document IDs if available)
387 if self.test_document_ids and len(self.test_document_ids) > 0:
388 request = FaissDeleteRequest(ids=self.test_document_ids[:5])
389 result = await self.faiss_service.delete_documents(request)
390
391 self.assert_test(result.success,
392 "Batch deletion",
393 f"Expected success=True, got success={result.success}")
394 else:
395 self.assert_test(True,
396 "Batch deletion",
397 "No test document IDs available for batch deletion test")
398
399 async def test_error_handling(self):
400 """Test error handling."""

Callers 1

run_all_testsMethod · 0.95

Calls 8

assert_testMethod · 0.95
FaissAddRequestClass · 0.90
FaissSearchRequestClass · 0.90
FaissDeleteRequestClass · 0.90
printFunction · 0.85
add_documentsMethod · 0.45
search_similarMethod · 0.45
delete_documentsMethod · 0.45

Tested by

no test coverage detected