Add one more test

This commit is contained in:
Nuno Campos 2023-08-23 19:52:13 +01:00
parent 882b97cfd2
commit 1751fe114d
2 changed files with 14 additions and 0 deletions

View File

@ -545,6 +545,9 @@
}
}
}
],
"input_variables": [
"question"
]
}
},

View File

@ -1106,6 +1106,17 @@ class FakeSplitIntoListParser(BaseOutputParser[List[str]]):
return text.strip().split(", ")
def test_each_simple() -> None:
"""Test that each() works with a simple runnable."""
parser = FakeSplitIntoListParser()
assert parser.invoke("first item, second item") == ["first item", "second item"]
assert parser.map().invoke(["a, b", "c"]) == [["a", "b"], ["c"]]
assert parser.map().map().invoke([["a, b", "c"], ["c, e"]]) == [
[["a", "b"], ["c"]],
[["c", "e"]],
]
def test_each(snapshot: SnapshotAssertion) -> None:
prompt = (
SystemMessagePromptTemplate.from_template("You are a nice assistant.")