@@ -508,7 +508,7 @@ async def mock_create_index(self, index):
508
508
509
509
async def mock_list_index_names (self ):
510
510
for index in []:
511
- yield index
511
+ yield index # pragma: no cover
512
512
513
513
monkeypatch .setattr (SearchIndexClient , "create_index" , mock_create_index )
514
514
monkeypatch .setattr (SearchIndexClient , "list_index_names" , mock_list_index_names )
@@ -562,17 +562,6 @@ async def mock_list_index_names(self):
562
562
@pytest .mark .asyncio
563
563
async def test_create_index_with_search_images_no_endpoint (monkeypatch , search_info ):
564
564
"""Test that SearchManager raises an error when search_images=True but no Azure Vision endpoint is provided."""
565
- indexes = []
566
-
567
- async def mock_create_index (self , index ):
568
- indexes .append (index )
569
-
570
- async def mock_list_index_names (self ):
571
- for index in []:
572
- yield index
573
-
574
- monkeypatch .setattr (SearchIndexClient , "create_index" , mock_create_index )
575
- monkeypatch .setattr (SearchIndexClient , "list_index_names" , mock_list_index_names )
576
565
577
566
# Create a SearchManager with search_images=True but no Azure Vision endpoint
578
567
manager = SearchManager (
@@ -599,25 +588,7 @@ async def mock_create_index(self, index):
599
588
600
589
async def mock_list_index_names (self ):
601
590
for index in []:
602
- yield index
603
-
604
- async def mock_create_client (* args , ** kwargs ):
605
- return MockClient (
606
- embeddings_client = MockEmbeddingsClient (
607
- create_embedding_response = openai .types .CreateEmbeddingResponse (
608
- object = "list" ,
609
- data = [
610
- openai .types .Embedding (
611
- embedding = [0.1 , 0.2 , 0.3 ],
612
- index = 0 ,
613
- object = "embedding" ,
614
- )
615
- ],
616
- model = MOCK_EMBEDDING_MODEL_NAME ,
617
- usage = Usage (prompt_tokens = 8 , total_tokens = 8 ),
618
- )
619
- )
620
- )
591
+ yield index # pragma: no cover
621
592
622
593
monkeypatch .setattr (SearchIndexClient , "create_index" , mock_create_index )
623
594
monkeypatch .setattr (SearchIndexClient , "list_index_names" , mock_list_index_names )
@@ -640,7 +611,6 @@ async def mock_create_client(*args, **kwargs):
640
611
credential = AzureKeyCredential ("test" ),
641
612
disable_batch = True ,
642
613
)
643
- monkeypatch .setattr (embeddings , "create_client" , mock_create_client )
644
614
645
615
# Create a SearchManager with both search_images and embeddings
646
616
manager = SearchManager (
0 commit comments