mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-07 05:30:39 +00:00
Add one more test
This commit is contained in:
parent
882b97cfd2
commit
1751fe114d
@ -545,6 +545,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"input_variables": [
|
||||||
|
"question"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1106,6 +1106,17 @@ class FakeSplitIntoListParser(BaseOutputParser[List[str]]):
|
|||||||
return text.strip().split(", ")
|
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:
|
def test_each(snapshot: SnapshotAssertion) -> None:
|
||||||
prompt = (
|
prompt = (
|
||||||
SystemMessagePromptTemplate.from_template("You are a nice assistant.")
|
SystemMessagePromptTemplate.from_template("You are a nice assistant.")
|
||||||
|
Loading…
Reference in New Issue
Block a user