combine python files (#256)

This commit is contained in:
Harrison Chase
2022-12-04 15:57:36 -08:00
committed by GitHub
parent 98fb19b535
commit f5c665a544
8 changed files with 21 additions and 76 deletions

View File

@@ -1,15 +0,0 @@
"""Test python chain."""
from langchain.chains.python import PythonChain
def test_functionality() -> None:
"""Test correct functionality."""
chain = PythonChain(input_key="code1", output_key="output1")
code = "print(1 + 1)"
output = chain({"code1": code})
assert output == {"code1": code, "output1": "2\n"}
# Test with the more user-friendly interface.
simple_output = chain.run(code)
assert simple_output == "2\n"

View File

@@ -32,3 +32,11 @@ def test_python_repl_pass_in_locals() -> None:
repl = PythonREPL(_locals=_locals)
repl.run("bar = foo * 2")
assert repl._locals["bar"] == 8
def test_functionality() -> None:
"""Test correct functionality."""
chain = PythonREPL()
code = "print(1 + 1)"
output = chain.run(code)
assert output == "2\n"