# SPDX-FileCopyrightText: 2026 Team Centurions # SPDX-License-Identifier: AGPL-3.0-or-later from pathlib import Path import pytest @pytest.fixture def grammar_text() -> str: path = Path(__file__).resolve().parent.parent / "grammars" / "task.gbnf" return path.read_text() def test_source_page_key_quoted(grammar_text: str): assert '"\\"source_page\\""' in grammar_text def test_captured_date_key_quoted(grammar_text: str): assert '"\\"captured_date\\""' in grammar_text def test_tasks_key_quoted(grammar_text: str): assert '"\\"tasks\\""' in grammar_text def test_task_keys_quoted(grammar_text: str): assert '"\\"task\\""' in grammar_text assert '"\\"due_date\\""' in grammar_text assert '"\\"priority\\""' in grammar_text def test_grammar_parses_sample_json(grammar_text: str): import re pattern = r'"\\"source_page\\""' assert re.search(pattern, grammar_text)