Spaces:
Runtime error
Runtime error
File size: 447 Bytes
2b4b6d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import json
from amo.evolution import _parse_candidate
def test_parse_json_candidate():
candidate = _parse_candidate(json.dumps({"code": "def f():\n return 1", "summary": "simple"}))
assert "return 1" in candidate.code
assert candidate.summary == "simple"
def test_parse_fenced_python_fallback():
candidate = _parse_candidate("Here is code:\n```python\ndef f():\n return 1\n```")
assert "return 1" in candidate.code
|