72 lines
2.5 KiB
Diff
72 lines
2.5 KiB
Diff
|
|
From 974ae2afa475e22cee517be414f61b1f2125f298 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Elenedeath Olawir <502132+Elenedeath@users.noreply.github.com>
|
||
|
|
Date: Tue, 6 Jan 2026 01:56:22 +0100
|
||
|
|
Subject: [PATCH] Replace delimitedList with DelimitedList in cxml tests
|
||
|
|
|
||
|
|
Updated usage of pyparsing's delimitedList to DelimitedList in the cxml test grammar for compatibility with newer pyparsing versions.
|
||
|
|
---
|
||
|
|
tests/unitutil/cxml.py | 6 +++---
|
||
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
|
||
|
|
Index: python_pptx-1.0.2/tests/unitutil/cxml.py
|
||
|
|
===================================================================
|
||
|
|
--- python_pptx-1.0.2.orig/tests/unitutil/cxml.py
|
||
|
|
+++ python_pptx-1.0.2/tests/unitutil/cxml.py
|
||
|
|
@@ -19,8 +19,8 @@ from pyparsing import (
|
||
|
|
alphanums,
|
||
|
|
alphas,
|
||
|
|
dblQuotedString,
|
||
|
|
- delimitedList,
|
||
|
|
- removeQuotes,
|
||
|
|
+ DelimitedList,
|
||
|
|
+ remove_quotes,
|
||
|
|
stringEnd,
|
||
|
|
)
|
||
|
|
|
||
|
|
@@ -43,8 +43,8 @@ def element(cxel_str: str) -> BaseOxmlEl
|
||
|
|
|
||
|
|
def xml(cxel_str: str) -> str:
|
||
|
|
"""Return the XML generated from `cxel_str`."""
|
||
|
|
- root_node.parseWithTabs()
|
||
|
|
- root_token = root_node.parseString(cxel_str)
|
||
|
|
+ root_node.parse_with_tabs()
|
||
|
|
+ root_token = root_node.parse_string(cxel_str)
|
||
|
|
xml = root_token.element.xml
|
||
|
|
return xml
|
||
|
|
|
||
|
|
@@ -254,28 +254,28 @@ def grammar():
|
||
|
|
attr_name = Word(alphas + ":")
|
||
|
|
attr_val = Word(alphanums + " %-./:_")
|
||
|
|
attr_def = Group(attr_name + equal + attr_val)
|
||
|
|
- attr_list = open_brace + delimitedList(attr_def) + close_brace
|
||
|
|
+ attr_list = open_brace + DelimitedList(attr_def) + close_brace
|
||
|
|
|
||
|
|
- text = dblQuotedString.setParseAction(removeQuotes)
|
||
|
|
+ text = dblQuotedString.set_parse_action(remove_quotes)
|
||
|
|
|
||
|
|
# w:jc{val=right} ----------------------------
|
||
|
|
element = (
|
||
|
|
tagname("tagname")
|
||
|
|
+ Group(Optional(attr_list))("attr_list")
|
||
|
|
+ Optional(text, default="")("text")
|
||
|
|
- ).setParseAction(Element.from_token)
|
||
|
|
+ ).set_parse_action(Element.from_token)
|
||
|
|
|
||
|
|
child_node_list = Forward()
|
||
|
|
|
||
|
|
node = Group(
|
||
|
|
element("element") + Group(Optional(slash + child_node_list))("child_node_list")
|
||
|
|
- ).setParseAction(connect_node_children)
|
||
|
|
+ ).set_parse_action(connect_node_children)
|
||
|
|
|
||
|
|
- child_node_list << (open_paren + delimitedList(node) + close_paren | node)
|
||
|
|
+ child_node_list << (open_paren + DelimitedList(node) + close_paren | node)
|
||
|
|
|
||
|
|
root_node = (
|
||
|
|
element("element") + Group(Optional(slash + child_node_list))("child_node_list") + stringEnd
|
||
|
|
- ).setParseAction(connect_root_node_children)
|
||
|
|
+ ).set_parse_action(connect_root_node_children)
|
||
|
|
|
||
|
|
return root_node
|
||
|
|
|