From bbe1903ec8e973064d3cdd4ca9a0075e72b8ca91 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 28 Sep 2026 13:20:22 +1300 Subject: [PATCH] qet-mcp: read a folio's tables from its block only (as #1097 does for texts) Co-Authored-By: Claude Opus 5.5 --- misc/qet-mcp/qet_mcp.py | 2 +- misc/qet-mcp/test_qet_mcp.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/misc/qet-mcp/qet_mcp.py b/misc/qet-mcp/qet_mcp.py index dfb320bd9..435f2e6b9 100755 --- a/misc/qet-mcp/qet_mcp.py +++ b/misc/qet-mcp/qet_mcp.py @@ -345,7 +345,7 @@ def _extras(root: ET.Element) -> dict: for n, d in _folios(root): folios[n] = {f: d.get(f, "") for f in _FOLIO_FIELDS} folio_uuids[n] = d.get("uuid", "") - for tb in d.iter("graphics_table"): + for tb in d.findall("tables/graphics_table"): tables.append(record( tb, {"folio": n, "name": tb.get("name", "")}, {"x": tb.get("x", ""), "y": tb.get("y", ""), "width": tb.get("width", ""), diff --git a/misc/qet-mcp/test_qet_mcp.py b/misc/qet-mcp/test_qet_mcp.py index 9dc45b65b..2677d7450 100644 --- a/misc/qet-mcp/test_qet_mcp.py +++ b/misc/qet-mcp/test_qet_mcp.py @@ -1242,8 +1242,8 @@ class DiffContracts(unittest.TestCase): def test_table_fields(self): def table(**v): a = {"x": "0", "y": "0", "width": "100", "height": "50", "display_n_row": "10", **v} - return ('') + return ('') for attr, reported in (("y", "y"), ("width", "width"), ("height", "height")): with self.subTest(attr=attr): d = m.tool_diff(self.qet(self.folio(extra=table())), @@ -1251,8 +1251,8 @@ class DiffContracts(unittest.TestCase): self.assertEqual([list(c["changed"]) for c in d["changed"]], [[reported]]) def test_tables(self): - table = lambda x, rows: ('') + table = lambda x, rows: ('') d = m.tool_diff(self.qet(self.folio(extra=table(0, 10))), self.qet(self.folio(extra=table(20, 12))))["tables"] self.assertEqual((d["keyed_by"], d["before"], d["after"]), ("uuid", 1, 1))