band-aider-pub/tests/ai_client/test_json_array_section.py
2026-10-17 11:57:37 -07:00

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"]