Skip to content

The agent engineering platform.

Update broken redis tests (#12371)

Tyler Hutcherson231d553824ac
diff --git a/libs/langchain/tests/integration_tests/vectorstores/test_redis.py b/libs/langchain/tests/integration_tests/vectorstores/test_redis.py
index 6128a8445a..28d524843a 100644
--- a/libs/langchain/tests/integration_tests/vectorstores/test_redis.py
+++ b/libs/langchain/tests/integration_tests/vectorstores/test_redis.py
@@ -141,7 +141,8 @@ def test_custom_keys(texts: List[str]) -> None:
docsearch, keys_out = Redis.from_texts_return_keys(
texts, FakeEmbeddings(), redis_url=TEST_REDIS_URL, keys=keys_in
)
- assert keys_in == keys_out
+ # it will append the index key prefix to all keys
+ assert keys_out == [docsearch.key_prefix + ":" + key for key in keys_in]
assert drop(docsearch.index_name)
@@ -154,11 +155,13 @@ def test_custom_keys_from_docs(texts: List[str]) -> None:
)
client = docsearch.client
# test keys are correct
- assert client.hget("test_key_1", "content")
+ assert client.hget(docsearch.key_prefix + ":" + "test_key_1", "content")
# test metadata is stored
- assert client.hget("test_key_1", "a") == bytes("b", "utf-8")
+ assert client.hget(docsearch.key_prefix + ":" + "test_key_1", "a") == bytes(
+ "b", "utf-8"
+ )
# test all keys are stored
- assert client.hget("test_key_2", "content")
+ assert client.hget(docsearch.key_prefix + ":" + "test_key_2", "content")
assert drop(docsearch.index_name)