mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: update test_get_command_completions to match new method signature with Document and CompleteEvent parameters
This commit is contained in:
parent
4ea68efd0e
commit
37236aa907
1 changed files with 15 additions and 2 deletions
|
@ -2,6 +2,8 @@ import os
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
from prompt_toolkit.document import Document
|
||||||
|
from prompt_toolkit.completion import CompleteEvent
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.io import AutoCompleter, ConfirmGroup, InputOutput
|
from aider.io import AutoCompleter, ConfirmGroup, InputOutput
|
||||||
|
@ -210,8 +212,19 @@ class TestInputOutput(unittest.TestCase):
|
||||||
|
|
||||||
autocompleter = AutoCompleter(root, rel_fnames, addable_rel_fnames, commands, "utf-8")
|
autocompleter = AutoCompleter(root, rel_fnames, addable_rel_fnames, commands, "utf-8")
|
||||||
|
|
||||||
# Test case for "/model gpt"
|
# Create instances of Document and CompleteEvent
|
||||||
result = autocompleter.get_command_completions("/model gpt", ["/model", "gpt"])
|
document = Document(text="/model gpt", cursor_position=len("/model gpt"))
|
||||||
|
complete_event = CompleteEvent()
|
||||||
|
|
||||||
|
# Call get_command_completions with the required parameters
|
||||||
|
completions = list(autocompleter.get_command_completions(
|
||||||
|
document, complete_event, "/model gpt", ["/model", "gpt"]
|
||||||
|
))
|
||||||
|
|
||||||
|
# Extract completion texts
|
||||||
|
result = [completion.text for completion in completions]
|
||||||
|
|
||||||
|
# Assert the result
|
||||||
self.assertEqual(result, ["gpt-3.5-turbo", "gpt-4"])
|
self.assertEqual(result, ["gpt-3.5-turbo", "gpt-4"])
|
||||||
commands.get_completions.assert_called_once_with("/model")
|
commands.get_completions.assert_called_once_with("/model")
|
||||||
commands.matching_commands.assert_called_once_with("/model")
|
commands.matching_commands.assert_called_once_with("/model")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue