Adjust unit_tests
This commit is contained in:
parent
f596f7729d
commit
ec518753c0
@ -1,4 +1,5 @@
|
|||||||
description: Generate unit tests.
|
description: Generate unit tests.
|
||||||
input: required
|
input: required
|
||||||
|
help: README.md
|
||||||
steps:
|
steps:
|
||||||
- run: $devchat_python $command_path/main.py "$input"
|
- run: $devchat_python $command_path/main.py "$input"
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Dict, List, Optional, Set
|
from typing import Dict, List, Optional, Set
|
||||||
@ -13,9 +12,13 @@ from tools.symbol_util import (
|
|||||||
split_tokens,
|
split_tokens,
|
||||||
)
|
)
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
from lib.ide_service import (
|
||||||
|
IDEService,
|
||||||
from libs.ide_services import IDEService, Location, Position, Range, SymbolNode
|
Location,
|
||||||
|
Position,
|
||||||
|
Range,
|
||||||
|
SymbolNode,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -142,7 +145,7 @@ def _extract_recommended_symbols_context(
|
|||||||
last_token = s
|
last_token = s
|
||||||
|
|
||||||
# locate the symbol in the file
|
# locate the symbol in the file
|
||||||
positions = locate_symbol_by_name(last_token, abs_path)
|
positions: List[Position] = locate_symbol_by_name(last_token, abs_path)
|
||||||
|
|
||||||
for pos in positions:
|
for pos in positions:
|
||||||
type_locations = client.find_type_def_locations(abs_path, pos.line, pos.character)
|
type_locations = client.find_type_def_locations(abs_path, pos.line, pos.character)
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from typing import Dict, List, Tuple
|
from typing import Dict, List, Tuple
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
sys.path.append(os.path.dirname(__file__))
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs"))
|
|
||||||
|
|
||||||
from cache import LocalCache
|
from cache import LocalCache
|
||||||
from chatmark import Checkbox, Form, Step, TextEditor # noqa: E402
|
|
||||||
from find_context import (
|
from find_context import (
|
||||||
Context,
|
Context,
|
||||||
Position,
|
Position,
|
||||||
@ -18,7 +12,6 @@ from find_context import (
|
|||||||
)
|
)
|
||||||
from find_reference_tests import find_reference_tests
|
from find_reference_tests import find_reference_tests
|
||||||
from i18n import TUILanguage, get_translation
|
from i18n import TUILanguage, get_translation
|
||||||
from ide_services import IDEService # noqa: E402
|
|
||||||
from model import (
|
from model import (
|
||||||
FuncToTest,
|
FuncToTest,
|
||||||
TokenBudgetExceededException,
|
TokenBudgetExceededException,
|
||||||
@ -28,6 +21,9 @@ from propose_test import propose_test
|
|||||||
from tools.file_util import retrieve_file_content
|
from tools.file_util import retrieve_file_content
|
||||||
from write_tests import write_and_print_tests
|
from write_tests import write_and_print_tests
|
||||||
|
|
||||||
|
from lib.chatmark import Checkbox, Form, Step, TextEditor
|
||||||
|
from lib.ide_service import IDEService
|
||||||
|
|
||||||
CHAT_WORKFLOW_DIR_PATH = [".chat", "workflows"]
|
CHAT_WORKFLOW_DIR_PATH = [".chat", "workflows"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ Answer in JSON format:
|
|||||||
|
|
||||||
FIND_REFERENCE_PROMPT = """
|
FIND_REFERENCE_PROMPT = """
|
||||||
Identify a suitable reference test file that can be used as a guide for writing test cases
|
Identify a suitable reference test file that can be used as a guide for writing test cases
|
||||||
for the function {function_name}, located in the file {file_path}.
|
for the function {function_name}, located in the file {file_path}.
|
||||||
The reference should provide a clear example of best practices in testing functions of a similar nature.
|
The reference should provide a clear example of best practices in testing functions of a similar nature.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from tools.file_util import retrieve_file_content
|
from tools.file_util import retrieve_file_content
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
|
from lib.ide_service import Position, SymbolNode
|
||||||
|
|
||||||
from libs.ide_services import Position, SymbolNode
|
|
||||||
|
|
||||||
|
|
||||||
def split_tokens(text: str) -> Dict[str, List[int]]:
|
def split_tokens(text: str) -> Dict[str, List[int]]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user