diff --git a/test-project/main.py b/test-project/main.py index 0e3208d..f8ff5de 100644 --- a/test-project/main.py +++ b/test-project/main.py @@ -1,26 +1,25 @@ -""" -Simple Python application for testing autonomous agent - Test Scenario 1 - -BUG: Missing json import (simple fix, should work in 1 attempt) -""" +import json from datetime import datetime def calculate_age(birth_year): - """Calculate age from birth year""" + """Calculate age based on birth year.""" current_year = datetime.now().year - return current_year - birth_year + age = current_year - birth_year + return age def format_greeting(name, birth_year): - """Format a greeting with age""" + """Format a greeting with name and age.""" age = calculate_age(birth_year) - # BUG: Missing import for json module (agent should fix this easily) + greeting = f"Hello, {name}! You are {age} years old." + + # Format as JSON for API response data = json.dumps({ + "greeting": greeting, "name": name, - "age": age, - "timestamp": datetime.now().isoformat() + "age": age }) return data if __name__ == "__main__": - result = format_greeting("Test User", 1990) + result = format_greeting("World", 2000) print(result)