22 lines
782 B
Python
22 lines
782 B
Python
# SPDX-FileCopyrightText: 2026 Art Sea LLC
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
"""Value-object contracts for parsed JSON prompt sections."""
|
|
|
|
from band_aider.ai_client.json_array_section import JsonArraySection
|
|
|
|
|
|
def test_json_array_section_preserves_the_exact_surrounding_prompt_fragments() -> None:
|
|
"""A parsed array retains the text that must be reconstructed around it."""
|
|
|
|
section = JsonArraySection(
|
|
before_array="Before: ",
|
|
items=[{"location": "src/widget.py"}, "keep this"],
|
|
after_array=" :after",
|
|
)
|
|
|
|
assert section.before_array + str(section.items) + section.after_array == (
|
|
"Before: [{'location': 'src/widget.py'}, 'keep this'] :after"
|
|
)
|
|
assert section.items == [{"location": "src/widget.py"}, "keep this"]
|