mirror of
https://github.com/TheR1D/shell_gpt.git
synced 2026-07-03 14:10:18 +02:00
Use OpenAI by default make LiteLLM optional (#488)
This commit is contained in:
+7
-7
@@ -9,7 +9,7 @@ from .utils import app, cmd_args, comp_args, mock_comp, runner
|
||||
role = SystemRole.get(DefaultRoles.CODE.value)
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_generation(completion):
|
||||
completion.return_value = mock_comp("print('Hello World')")
|
||||
|
||||
@@ -23,7 +23,7 @@ def test_code_generation(completion):
|
||||
|
||||
@patch("sgpt.printer.TextPrinter.live_print")
|
||||
@patch("sgpt.printer.MarkdownPrinter.live_print")
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_generation_no_markdown(completion, markdown_printer, text_printer):
|
||||
completion.return_value = mock_comp("print('Hello World')")
|
||||
|
||||
@@ -36,7 +36,7 @@ def test_code_generation_no_markdown(completion, markdown_printer, text_printer)
|
||||
text_printer.assert_called()
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_generation_stdin(completion):
|
||||
completion.return_value = mock_comp("# Hello\nprint('Hello')")
|
||||
|
||||
@@ -51,7 +51,7 @@ def test_code_generation_stdin(completion):
|
||||
assert "print('Hello')" in result.stdout
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_chat(completion):
|
||||
completion.side_effect = [
|
||||
mock_comp("print('hello')"),
|
||||
@@ -92,7 +92,7 @@ def test_code_chat(completion):
|
||||
# TODO: Code chat can be recalled without --code option.
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_repl(completion):
|
||||
completion.side_effect = [
|
||||
mock_comp("print('hello')"),
|
||||
@@ -124,7 +124,7 @@ def test_code_repl(completion):
|
||||
assert "print('world')" in result.stdout
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_and_shell(completion):
|
||||
args = {"--code": True, "--shell": True}
|
||||
result = runner.invoke(app, cmd_args(**args))
|
||||
@@ -134,7 +134,7 @@ def test_code_and_shell(completion):
|
||||
assert "Error" in result.stdout
|
||||
|
||||
|
||||
@patch("litellm.completion")
|
||||
@patch("sgpt.handlers.handler.completion")
|
||||
def test_code_and_describe_shell(completion):
|
||||
args = {"--code": True, "--describe-shell": True}
|
||||
result = runner.invoke(app, cmd_args(**args))
|
||||
|
||||
Reference in New Issue
Block a user