mirror of
https://github.com/hanzoai/stack.git
synced 2026-11-19 03:06:57 +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])
|