# Copyright (c) 2025-2026, RTE (https://www.rte-france.com) # This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0. # If a copy of the Mozilla Public License, version 2.0 was not distributed with this file, # you can obtain one at http://mozilla.org/MPL/2.0/. # SPDX-License-Identifier: MPL-2.0 """Unit tests for the Co-Study4Grid overflow-graph overlay injector and the dynamic ``/results/pdf/{filename}`` route that serves it. The overlay is plain string substitution by design (no HTML parser dependency) — exercising it is therefore deterministic and fast. """ from __future__ import annotations import re from pathlib import Path import pytest from fastapi.testclient import TestClient from expert_backend.main import app from expert_backend.services.overflow_overlay import inject_overlay _BASE_HTML = ( '