Source code for test_postprocessor

import asyncio
from response_postprocessor import postprocess_response

[docs] async def main(): """Smoke-test :func:`postprocess_response` against header/tool-call inputs. Drives ``response_postprocessor.postprocess_response`` over a small list of hard-coded sample responses and prints the ``repr`` of each result so the full postprocessing pipeline (thought stripping, header normalization, LaTeX/table conversion, metadata stripping, etc.) can be eyeballed. The three fixtures here focus on the first-line bracket header in combination with: a bare header, a header followed by a ``<tool_call>`` JSON block, and a header preceded by a ``<thought>`` block. This is a manual developer harness, not an assertion-based test: it makes no assertions and touches no external systems (no Redis streams, knowledge graph, LLM, or HTTP), only writing to stdout. The function is ``async`` and invoked via ``asyncio.run`` purely for a consistent entrypoint; ``postprocess_response`` itself is synchronous, so nothing is awaited. Called by the module-level ``asyncio.run(main())`` at the bottom of this file; no other internal callers were found. Returns: None. Each test case's output is emitted to stdout via ``print``. """ test_texts = [ """[ gemini-3.1-pro-preview :: 🐉🥃🔎⚙️ :: Cross-referencing the "Big Jiao" variable against the Limbus Company and Dream of the Red Chamber semantic matrices. :: brave_web_search ]""", """[ gemini-3.1-pro-preview :: 🐉🥃🔎⚙️ :: Cross-referencing the "Big Jiao" variable against the Limbus Company and Dream of the Red Chamber semantic matrices. :: brave_web_search ]\n<tool_call>{"name": "brave_web_search"}</tool_call>""", """<thought>I should do this</thought>\n[ gemini-3.1-pro-preview :: 🐉🥃🔎⚙️ :: Cross-referencing the "Big Jiao" variable against the Limbus Company and Dream of the Red Chamber semantic matrices. :: brave_web_search ]""" ] for i, t in enumerate(test_texts): out = postprocess_response(t) print(f"Test {i} output:") print(repr(out))
asyncio.run(main())