Skip to content

The agent engineering platform.

Skip in py3.8

Nuno Campos7bfee012d596
diff --git a/libs/langchain/langchain/schema/runnable/utils.py b/libs/langchain/langchain/schema/runnable/utils.py
index 7fb08b433f..b312c8d917 100644
--- a/libs/langchain/langchain/schema/runnable/utils.py
+++ b/libs/langchain/langchain/schema/runnable/utils.py
@@ -120,7 +120,6 @@ def get_lambda_source(func: Callable) -> Optional[str]:
"""
try:
code = inspect.getsource(func)
- print(code)
tree = ast.parse(textwrap.dedent(code))
visitor = GetLambdaSource()
visitor.visit(tree)
diff --git a/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py b/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py
index e276e0a141..19ec18966a 100644
--- a/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py
+++ b/libs/langchain/tests/unit_tests/schema/runnable/test_runnable.py
@@ -1277,7 +1277,8 @@ def test_combining_sequences(
assert chain.first == prompt
assert chain.middle == [chat]
assert chain.last == parser
- assert dumps(chain, pretty=True) == snapshot
+ if sys.version_info >= (3, 9):
+ assert dumps(chain, pretty=True) == snapshot
prompt2 = (
SystemMessagePromptTemplate.from_template("You are a nicer assistant.")
@@ -2101,7 +2102,8 @@ async def test_llm_with_fallbacks(
assert await runnable.ainvoke("hello") == "bar"
assert await runnable.abatch(["hi", "hey", "bye"]) == ["bar"] * 3
assert list(await runnable.ainvoke("hello")) == list("bar")
- assert dumps(runnable, pretty=True) == snapshot
+ if sys.version_info >= (3, 9):
+ assert dumps(runnable, pretty=True) == snapshot
class FakeSplitIntoListParser(BaseOutputParser[List[str]]):
@@ -2744,7 +2746,7 @@ async def test_runnable_branch_abatch() -> None:
@pytest.mark.skipif(
sys.version_info < (3, 9), reason="Requires python version >= 3.9 to run."
)
-def test_reprsentation_of_runnables() -> None:
+def test_representation_of_runnables() -> None:
"""Test representation of runnables."""
runnable = RunnableLambda(lambda x: x * 2)
assert repr(runnable) == "RunnableLambda(lambda x: x * 2)"