mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-19 17:45:25 +00:00
Update broken redis tests (#12371)
Update broken redis tests -- tiny PR :) - **Description:** Fixes Redis tests on master (look like it was broken by https://github.com/langchain-ai/langchain/pull/11257) - **Issue:** None, - **Dependencies:** No - **Tag maintainer:** @baskaryan @Spartee - **Twitter handle:** N/A Co-authored-by: Sam Partee <sam.partee@redis.com>
This commit is contained in:
parent
b8af5b0a8e
commit
231d553824
@ -141,7 +141,8 @@ def test_custom_keys(texts: List[str]) -> None:
|
|||||||
docsearch, keys_out = Redis.from_texts_return_keys(
|
docsearch, keys_out = Redis.from_texts_return_keys(
|
||||||
texts, FakeEmbeddings(), redis_url=TEST_REDIS_URL, keys=keys_in
|
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)
|
assert drop(docsearch.index_name)
|
||||||
|
|
||||||
|
|
||||||
@ -154,11 +155,13 @@ def test_custom_keys_from_docs(texts: List[str]) -> None:
|
|||||||
)
|
)
|
||||||
client = docsearch.client
|
client = docsearch.client
|
||||||
# test keys are correct
|
# 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
|
# 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
|
# 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)
|
assert drop(docsearch.index_name)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user