mirror of
https://github.com/hwchase17/langchain.git
synced 2026-03-18 11:07:36 +00:00
test(core): add edge case for empty examples in LengthBasedExampleSelector (#34641)
This commit is contained in:
@@ -57,3 +57,18 @@ def test_selector_trims_all_examples(
|
||||
super super super super long, this will affect the example right?"""
|
||||
output = selector.select_examples({"question": longest_question})
|
||||
assert output == []
|
||||
|
||||
|
||||
# edge case
|
||||
def test_selector_empty_example(
|
||||
selector: LengthBasedExampleSelector,
|
||||
) -> None:
|
||||
"""Test Empty Example result empty."""
|
||||
empty_list: list[dict] = []
|
||||
empty_selector = LengthBasedExampleSelector(
|
||||
examples=empty_list,
|
||||
example_prompt=selector.example_prompt,
|
||||
max_length=30,
|
||||
)
|
||||
output = empty_selector.select_examples({"question": "empty question"})
|
||||
assert output == []
|
||||
|
||||
Reference in New Issue
Block a user