|
From: <gr...@us...> - 2019-08-19 19:41:39
|
Revision: 8315
http://sourceforge.net/p/docutils/code/8315
Author: grubert
Date: 2019-08-19 19:41:38 +0000 (Mon, 19 Aug 2019)
Log Message:
-----------
Add regression test for odt contents
Fix: xml.etree.ElementTree Element.getchildren deprecated warning
Modified Paths:
--------------
trunk/docutils/docutils/writers/odf_odt/__init__.py
trunk/docutils/test/test_writers/test_odt.py
Added Paths:
-----------
trunk/docutils/test/functional/expected/odt_contents.odt
trunk/docutils/test/functional/input/odt_contents.txt
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2019-08-19 19:31:52 UTC (rev 8314)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2019-08-19 19:41:38 UTC (rev 8315)
@@ -2763,8 +2763,7 @@
if WhichElementTree != "lxml":
s1 = s1.encode("utf-8")
el1 = etree.fromstring(s1)
- children = el1.getchildren()
- for child in children:
+ for child in el1:
self.current_element.append(child)
def depart_literal_block(self, node):
@@ -3460,7 +3459,7 @@
def update_toc_collect(self, el, level, collection):
collection.append((level, el))
level += 1
- for child_el in el.getchildren():
+ for child_el in el:
if child_el.tag != 'text:index-body':
self.update_toc_collect(child_el, level, collection)
Added: trunk/docutils/test/functional/expected/odt_contents.odt
===================================================================
(Binary files differ)
Index: trunk/docutils/test/functional/expected/odt_contents.odt
===================================================================
--- trunk/docutils/test/functional/expected/odt_contents.odt 2019-08-19 19:31:52 UTC (rev 8314)
+++ trunk/docutils/test/functional/expected/odt_contents.odt 2019-08-19 19:41:38 UTC (rev 8315)
Property changes on: trunk/docutils/test/functional/expected/odt_contents.odt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/docutils/test/functional/input/odt_contents.txt
===================================================================
--- trunk/docutils/test/functional/input/odt_contents.txt (rev 0)
+++ trunk/docutils/test/functional/input/odt_contents.txt 2019-08-19 19:41:38 UTC (rev 8315)
@@ -0,0 +1,15 @@
+=================
+Table of contents
+=================
+
+.. contents::
+
+In short
+========
+
+Regression to test table of contents construction
+
+End
+===
+
+this
Property changes on: trunk/docutils/test/functional/input/odt_contents.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Modified: trunk/docutils/test/test_writers/test_odt.py
===================================================================
--- trunk/docutils/test/test_writers/test_odt.py 2019-08-19 19:31:52 UTC (rev 8314)
+++ trunk/docutils/test/test_writers/test_odt.py 2019-08-19 19:41:38 UTC (rev 8315)
@@ -199,6 +199,9 @@
def test_odt_literal_block(self):
self.process_test('odt_literal_block.txt', 'odt_literal_block.odt')
+ def test_odt_contents(self):
+ self.process_test('odt_contents.txt', 'odt_contents.odt')
+
#
# Template for new tests.
# Also add functional/input/odt_xxxx.txt and
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|