mirror of
https://github.com/hanzoai/aci.git
synced 2026-10-30 18:49:51 +00:00
22 lines
495 B
Python
22 lines
495 B
Python
import json
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def temp_file():
|
|
"""Create a temporary file for testing."""
|
|
with tempfile.NamedTemporaryFile(delete=False) as f:
|
|
yield Path(f.name)
|
|
try:
|
|
Path(f.name).unlink()
|
|
except FileNotFoundError:
|
|
pass
|
|
|
|
|
|
def parse_result(result: str) -> dict:
|
|
"""Parse the JSON result from file_editor."""
|
|
return json.loads(result[result.find('{') : result.rfind('}') + 1])
|