mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
x
This commit is contained in:
parent
c86b2b5e42
commit
d1d7d0cb27
@ -1,3 +1,5 @@
|
|||||||
|
from typing import Callable
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from langchain.schema.runnable.utils import (
|
from langchain.schema.runnable.utils import (
|
||||||
@ -6,7 +8,6 @@ from langchain.schema.runnable.utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Test get_lambda_source function
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"func, expected_source",
|
"func, expected_source",
|
||||||
[
|
[
|
||||||
@ -15,7 +16,8 @@ from langchain.schema.runnable.utils import (
|
|||||||
(lambda x: x if x > 0 else 0, "lambda x: x if x > 0 else 0"),
|
(lambda x: x if x > 0 else 0, "lambda x: x if x > 0 else 0"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_get_lambda_source(func, expected_source):
|
def test_get_lambda_source(func: Callable, expected_source: str) -> None:
|
||||||
|
"""Test get_lambda_source function"""
|
||||||
source = get_lambda_source(func)
|
source = get_lambda_source(func)
|
||||||
assert source == expected_source
|
assert source == expected_source
|
||||||
|
|
||||||
@ -27,6 +29,7 @@ def test_get_lambda_source(func, expected_source):
|
|||||||
("line 1\nline 2\nline 3", "ax", "line 1\n line 2\n line 3"),
|
("line 1\nline 2\nline 3", "ax", "line 1\n line 2\n line 3"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_indent_lines_after_first(text, prefix, expected_output):
|
def test_indent_lines_after_first(text: str, prefix: str, expected_output: str) -> None:
|
||||||
|
"""Test indent_lines_after_first function"""
|
||||||
indented_text = indent_lines_after_first(text, prefix)
|
indented_text = indent_lines_after_first(text, prefix)
|
||||||
assert indented_text == expected_output
|
assert indented_text == expected_output
|
||||||
|
Loading…
Reference in New Issue
Block a user