test: parse the page instead of matching tags with a regex

The inline-script check matched <script\b[^>]*> and then filtered the matched text, so a > inside an attribute value split one tag into a fragment that had already lost the attribute the filter looks for. An html.parser subclass decides on the parsed attributes instead. The i18n test imported unittest twice, once plain and once as a from-import.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-23 02:09:23 +02:00
parent 87c4405aa4
commit 4cc8052a88
2 changed files with 20 additions and 8 deletions

View File

@@ -2,8 +2,8 @@ import re
import shutil
import tempfile
import unittest
import unittest.mock
from pathlib import Path
from unittest import mock
import yaml
@@ -170,7 +170,7 @@ class TestCatalogMerge(unittest.TestCase):
)
def test_an_unsupported_code_never_becomes_a_path(self):
with mock.patch.object(i18n, "read_catalog") as read:
with unittest.mock.patch.object(i18n, "read_catalog") as read:
self.assertEqual(i18n.catalog("../content/de"), {})
read.assert_not_called()