mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
test: enhance Python test case with class and type annotations
This commit is contained in:
parent
00f79fecd0
commit
0faff91c72
1 changed files with 27 additions and 2 deletions
|
@ -480,8 +480,33 @@ let () =
|
||||||
),
|
),
|
||||||
"python": (
|
"python": (
|
||||||
"test.py",
|
"test.py",
|
||||||
'def greet(name):\n print(f"Hello, {name}!")\n',
|
'''from typing import Optional, List
|
||||||
"greet", # Key symbol to check
|
|
||||||
|
class Person:
|
||||||
|
"""A class representing a person."""
|
||||||
|
|
||||||
|
def __init__(self, name: str, age: Optional[int] = None):
|
||||||
|
self.name = name
|
||||||
|
self.age = age
|
||||||
|
|
||||||
|
def greet(self, formal: bool = False) -> str:
|
||||||
|
"""Generate a greeting."""
|
||||||
|
prefix = "Good day" if formal else "Hello"
|
||||||
|
return f"{prefix}, {self.name}!"
|
||||||
|
|
||||||
|
def create_greeting_list(people: List[Person]) -> List[str]:
|
||||||
|
"""Create greetings for a list of people."""
|
||||||
|
return [person.greet() for person in people]
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
DEFAULT_NAME = "World"
|
||||||
|
MAX_AGE = 150
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
person = Person(DEFAULT_NAME)
|
||||||
|
print(person.greet())
|
||||||
|
''',
|
||||||
|
"Person", # Key symbol to check
|
||||||
),
|
),
|
||||||
"ql": (
|
"ql": (
|
||||||
"test.ql",
|
"test.ql",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue