mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 13:24:14 +02:00
Merge branch 'feat/qet-mcp-diff-uuids' into feat/qet-mcp-items
This commit is contained in:
@@ -375,7 +375,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", ""),
|
||||
|
||||
@@ -1305,8 +1305,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 ('<graphics_table uuid="{tb}" name="P" '
|
||||
+ " ".join(f'{k}="{w}"' for k, w in a.items()) + '/>')
|
||||
return ('<tables><graphics_table uuid="{tb}" name="P" '
|
||||
+ " ".join(f'{k}="{w}"' for k, w in a.items()) + '/></tables>')
|
||||
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())),
|
||||
@@ -1314,8 +1314,8 @@ class DiffContracts(unittest.TestCase):
|
||||
self.assertEqual([list(c["changed"]) for c in d["changed"]], [[reported]])
|
||||
|
||||
def test_tables(self):
|
||||
table = lambda x, rows: ('<graphics_table uuid="{tb}" name="Parts" x="' + str(x)
|
||||
+ f'" y="0" width="100" height="50" display_n_row="{rows}"/>')
|
||||
table = lambda x, rows: ('<tables><graphics_table uuid="{tb}" name="Parts" x="' + str(x)
|
||||
+ f'" y="0" width="100" height="50" display_n_row="{rows}"/></tables>')
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user