Skip to content

Commit

Permalink
add delete and increase sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescalam committed Apr 27, 2024
1 parent c4dd453 commit 9f16810
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unit/test_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,17 @@ def test_query_filter_pinecone(self, openai_encoder, routes, index_cls):
route_layer = RouteLayer(
encoder=openai_encoder, routes=routes, index=pineconeindex
)
time.sleep(5) # allow for index to be populated
time.sleep(10) # allow for index to be populated
query_result = route_layer(text="Hello", route_filter=["Route 1"]).name

try:
route_layer(text="Hello", route_filter=["Route 8"]).name
except ValueError:
assert True

# delete index
pineconeindex.delete_index()

assert query_result in ["Route 1"]

def test_namespace_pinecone_index(self, openai_encoder, routes, index_cls):
Expand All @@ -296,14 +299,17 @@ def test_namespace_pinecone_index(self, openai_encoder, routes, index_cls):
route_layer = RouteLayer(
encoder=openai_encoder, routes=routes, index=pineconeindex
)
time.sleep(5) # allow for index to be populated
time.sleep(10) # allow for index to be populated
query_result = route_layer(text="Hello", route_filter=["Route 1"]).name

try:
route_layer(text="Hello", route_filter=["Route 8"]).name
except ValueError:
assert True

# delete index
pineconeindex.delete_index()

assert query_result in ["Route 1"]

def test_query_with_no_index(self, openai_encoder, index_cls):
Expand Down

0 comments on commit 9f16810

Please sign in to comment.