[core] add test for json parser (#15297)

this should fail, but isnt

---------

Co-authored-by: Nuno Campos <nuno@langchain.dev>
This commit is contained in:
Harrison Chase
2023-12-29 09:59:39 -08:00
committed by GitHub
parent ec090745a6
commit c3b3b77a11
3 changed files with 36 additions and 20 deletions

View File

@@ -487,3 +487,9 @@ async def test_partial_text_json_output_parser_diff_async() -> None:
chain = input_iter | SimpleJsonOutputParser(diff=True)
assert [p async for p in chain.astream(None)] == EXPECTED_STREAMED_JSON_DIFF
def test_raises_error() -> None:
parser = SimpleJsonOutputParser()
with pytest.raises(Exception):
parser.invoke("hi")