mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
21 lines
473 B
Python
21 lines
473 B
Python
|
from langchain.output_parsers.boolean import BooleanOutputParser
|
||
|
|
||
|
|
||
|
def test_boolean_output_parser_parse() -> None:
|
||
|
parser = BooleanOutputParser()
|
||
|
|
||
|
# Test valid input
|
||
|
result = parser.parse("YES")
|
||
|
assert result is True
|
||
|
|
||
|
# Test valid input
|
||
|
result = parser.parse("NO")
|
||
|
assert result is False
|
||
|
|
||
|
# Test invalid input
|
||
|
try:
|
||
|
parser.parse("INVALID")
|
||
|
assert False, "Should have raised ValueError"
|
||
|
except ValueError:
|
||
|
pass
|