From de2e7f0791ea1963e022c36da8c1e3ea8a9a5648 Mon Sep 17 00:00:00 2001 From: jasomorg Date: Thu, 18 Nov 2021 15:59:53 +0000 Subject: [PATCH] Include fix for XML output formatting being minified in the last two tests Removed needless elipses Replace elipses with Remove doctest: +SKIP (oops) --- pypeg2/xmlast.py | 1 + samples/sample2.py | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pypeg2/xmlast.py b/pypeg2/xmlast.py index b02882f..0145a34 100644 --- a/pypeg2/xmlast.py +++ b/pypeg2/xmlast.py @@ -126,6 +126,7 @@ def thing2xml(thing, pretty=False, object_names=False): if pretty: warnings.warn("lxml is needed for pretty printing", ImportWarning) + etree.indent(tree) return etree.tostring(tree) diff --git a/samples/sample2.py b/samples/sample2.py index edd80ca..5fb1711 100644 --- a/samples/sample2.py +++ b/samples/sample2.py @@ -48,7 +48,7 @@ that=new one once=anything twice=goes [Number 3] -... + pyPEG contains an XML backend, too: @@ -63,14 +63,13 @@ pyPEG contains an XML backend, too: anything goes -
+
-... In this sample the tree contains named objects only. Then we can output object names as tag names. Spaces in names will be translated into underscores. ->>> print(thing2xml(ini_file, pretty=True, object_names=True).decode()) # doctest: +SKIP +>>> print(thing2xml(ini_file, pretty=True, object_names=True).decode()) something @@ -80,9 +79,8 @@ names as tag names. Spaces in names will be translated into underscores. anything goes - + -... """ from __future__ import unicode_literals, print_function