44from typing import Generator
55
66import pytest
7- from flaky import flaky # type:ignore[import-untyped]
87from langchain_core .documents import Document
98from langchain_core .language_models .chat_models import BaseChatModel
109from langchain_core .messages import AIMessage
@@ -143,7 +142,6 @@ def test_add_docs_store(graph_store):
143142 assert 4 <= len (extracted_entities ) < 8
144143
145144
146- # @flaky(max_runs=3, min_passes=1)
147145def test_extract_entity_names (graph_store , query_connection ):
148146 query_entity_names = graph_store .extract_entity_names (query_connection )
149147 assert set (query_entity_names ) == {"John Doe" , "Jane Smith" }
@@ -155,7 +153,6 @@ def test_extract_entities_from_empty_string_names(graph_store):
155153 assert len (no_names ) == 0
156154
157155
158- # @flaky(max_runs=3, min_passes=1)
159156def test_related_entities (graph_store ):
160157 entity_names = ["John Doe" , "Jane Smith" ]
161158 related_entities = graph_store .related_entities (entity_names )
@@ -166,7 +163,6 @@ def test_related_entities(graph_store):
166163 assert len (no_entities ) == 0
167164
168165
169- # @flaky(max_runs=3, min_passes=1)
170166def test_additional_entity_examples (entity_extraction_model , entity_example , documents ):
171167 # First, create one client just to drop any existing collections
172168 client = MongoClient (CONNECTION_STRING )
@@ -190,15 +186,13 @@ def test_additional_entity_examples(entity_extraction_model, entity_example, doc
190186 assert len (new_entities ) >= 2
191187
192188
193- # @flaky(max_runs=3, min_passes=1)
194189def test_chat_response (graph_store , query_connection ):
195190 """Displays querying an existing Knowledge Graph Database"""
196191 answer = graph_store .chat_response (query_connection )
197192 assert isinstance (answer , AIMessage )
198193 assert "acme corporation" in answer .content .lower ()
199194
200195
201- # @flaky(max_runs=3, min_passes=1)
202196def test_similarity_search (graph_store , query_connection ):
203197 docs = graph_store .similarity_search (query_connection )
204198 assert len (docs ) >= 4
@@ -207,7 +201,6 @@ def test_similarity_search(graph_store, query_connection):
207201 assert any ("attributes" in d .keys () for d in docs )
208202
209203
210- # @flaky(max_runs=3, min_passes=1)
211204def test_validator (documents , entity_extraction_model ):
212205 # Case 1. No existing collection.
213206 client = MongoClient (CONNECTION_STRING )
@@ -261,7 +254,6 @@ def test_validator(documents, entity_extraction_model):
261254 client .close ()
262255
263256
264- # @flaky(max_runs=3, min_passes=1)
265257def test_allowed_entity_types (documents , entity_extraction_model ):
266258 """Add allowed_entity_types. Use the validator to confirm behaviour."""
267259 allowed_entity_types = ["Person" ]
@@ -289,7 +281,6 @@ def test_allowed_entity_types(documents, entity_extraction_model):
289281 all ([len (e ["relationships" ].get ("attributes" , [])) == 0 for e in entities ])
290282
291283
292- # @flaky(max_runs=3, min_passes=1)
293284def test_allowed_relationship_types (documents , entity_extraction_model ):
294285 # drop collection
295286 client = MongoClient (CONNECTION_STRING )
0 commit comments