Skip to content

Commit

Permalink
Natural language server
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Oct 15, 2024
1 parent 2e0e8bd commit bbbdc76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
readme = "README.md"
Expand Down
16 changes: 11 additions & 5 deletions tests/core/test_async_core.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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)

0 comments on commit bbbdc76

Please sign in to comment.