The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
test(core): add edge case for empty examples in LengthBasedExampleSelector (#34641)
Manas karthik48cd13114fa7
diff --git a/libs/core/tests/unit_tests/example_selectors/test_length_based_example_selector.py b/libs/core/tests/unit_tests/example_selectors/test_length_based_example_selector.pyindex b808657dc8..f3bfe3b5a9 100644--- a/libs/core/tests/unit_tests/example_selectors/test_length_based_example_selector.py+++ b/libs/core/tests/unit_tests/example_selectors/test_length_based_example_selector.py@@ -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 == []