mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-12 02:26:23 +00:00
Previously, if this did not find a mypy cache then it wouldnt run this makes it always run adding mypy ignore comments with existing uncaught issues to unblock other prs --------- Co-authored-by: Erick Friis <erick@langchain.dev> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
from langchain_community.graphs.neo4j_graph import value_sanitize
|
|
|
|
|
|
def test_value_sanitize_with_small_list(): # type: ignore[no-untyped-def]
|
|
small_list = list(range(15)) # list size > LIST_LIMIT
|
|
input_dict = {"key1": "value1", "small_list": small_list}
|
|
expected_output = {"key1": "value1", "small_list": small_list}
|
|
assert value_sanitize(input_dict) == expected_output
|
|
|
|
|
|
def test_value_sanitize_with_oversized_list(): # type: ignore[no-untyped-def]
|
|
oversized_list = list(range(150)) # list size > LIST_LIMIT
|
|
input_dict = {"key1": "value1", "oversized_list": oversized_list}
|
|
expected_output = {
|
|
"key1": "value1"
|
|
# oversized_list should not be included
|
|
}
|
|
assert value_sanitize(input_dict) == expected_output
|
|
|
|
|
|
def test_value_sanitize_with_nested_oversized_list(): # type: ignore[no-untyped-def]
|
|
oversized_list = list(range(150)) # list size > LIST_LIMIT
|
|
input_dict = {"key1": "value1", "oversized_list": {"key": oversized_list}}
|
|
expected_output = {"key1": "value1", "oversized_list": {}}
|
|
assert value_sanitize(input_dict) == expected_output
|
|
|
|
|
|
def test_value_sanitize_with_dict_in_list(): # type: ignore[no-untyped-def]
|
|
oversized_list = list(range(150)) # list size > LIST_LIMIT
|
|
input_dict = {"key1": "value1", "oversized_list": [1, 2, {"key": oversized_list}]}
|
|
expected_output = {"key1": "value1", "oversized_list": [1, 2, {}]}
|
|
assert value_sanitize(input_dict) == expected_output
|