From bbbdc767e5a3ca49a4dd5c8183b31aa731992bd8 Mon Sep 17 00:00:00 2001 From: killian <63927363+KillianLucas@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:42:37 -0700 Subject: [PATCH] Natural language server --- pyproject.toml | 2 +- tests/core/test_async_core.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0cb6d4e137..c333869128 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ packages = [ {include = "interpreter"}, {include = "scripts"}, ] -version = "0.3.13" # Use "-rc1", "-rc2", etc. for pre-release versions +version = "0.3.14" # Use "-rc1", "-rc2", etc. for pre-release versions description = "Let language models run code" authors = ["Killian Lucas "] readme = "README.md" diff --git a/tests/core/test_async_core.py b/tests/core/test_async_core.py index 7da29581b7..b7a9a31017 100644 --- a/tests/core/test_async_core.py +++ b/tests/core/test_async_core.py @@ -1,7 +1,7 @@ import os from unittest import TestCase, mock -from interpreter.core.async_core import Server, AsyncInterpreter +from interpreter.core.async_core import AsyncInterpreter, Server class TestServerConstruction(TestCase): @@ -20,7 +20,7 @@ def test_host_and_port_defaults(self): s = Server(AsyncInterpreter()) self.assertEqual(s.host, Server.DEFAULT_HOST) self.assertEqual(s.port, Server.DEFAULT_PORT) - + def test_host_and_port_passed_in(self): """ Tests that a Server object takes on the passed-in host and port when they are passed-in, @@ -29,11 +29,14 @@ def test_host_and_port_passed_in(self): host = "the-really-real-host" port = 2222 - with mock.patch.dict(os.environ, {"HOST": "this-is-supes-fake", "PORT": "9876"}): + with mock.patch.dict( + os.environ, + {"INTERPRETER_HOST": "this-is-supes-fake", "INTERPRETER_PORT": "9876"}, + ): sboth = Server(AsyncInterpreter(), host, port) self.assertEqual(sboth.host, host) self.assertEqual(sboth.port, port) - + def test_host_and_port_from_env_1(self): """ Tests that the Server object takes on the HOST and PORT env vars as host and port when @@ -42,7 +45,10 @@ def test_host_and_port_from_env_1(self): fake_host = "fake_host" fake_port = 1234 - with mock.patch.dict(os.environ, {"HOST": fake_host, "PORT": str(fake_port)}): + with mock.patch.dict( + os.environ, + {"INTERPRETER_HOST": fake_host, "INTERPRETER_PORT": str(fake_port)}, + ): s = Server(AsyncInterpreter()) self.assertEqual(s.host, fake_host) self.assertEqual(s.port, fake_port)