diff options
| author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-08-19 20:05:56 +0000 |
|---|---|---|
| committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-08-19 20:05:56 +0000 |
| commit | cb6d72b599015e1069eae216e8a516aa1484255c (patch) | |
| tree | 2be69f779f28ce9fb728242f8b9b3ed503ff5936 /docutils | |
| parent | 510e6a6b8fd1c02a26716b7a694334710171e053 (diff) | |
| download | docutils-cb6d72b599015e1069eae216e8a516aa1484255c.tar.gz | |
Add odt classifier test
Fix: xml.etree.ElementTree Element.getchildren deprecated warning
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8316 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
| -rw-r--r-- | docutils/docutils/writers/odf_odt/__init__.py | 5 | ||||
| -rw-r--r-- | docutils/test/functional/expected/odt_classifier.odt | bin | 0 -> 9139 bytes | |||
| -rw-r--r-- | docutils/test/functional/input/odt_classifier.txt | 13 | ||||
| -rwxr-xr-x | docutils/test/test_writers/test_odt.py | 3 |
4 files changed, 18 insertions, 3 deletions
diff --git a/docutils/docutils/writers/odf_odt/__init__.py b/docutils/docutils/writers/odf_odt/__init__.py index 0b61cec84..60077f2a8 100644 --- a/docutils/docutils/writers/odf_odt/__init__.py +++ b/docutils/docutils/writers/odf_odt/__init__.py @@ -1938,9 +1938,8 @@ class ODFTranslator(nodes.GenericNodeVisitor): self.bumped_list_level_stack.pop() def visit_classifier(self, node): - els = self.current_element.getchildren() - if len(els) > 0: - el = els[-1] + if len(self.current_element) > 0: + el = self.current_element[-1] el1 = SubElement( el, 'text:span', attrib={'text:style-name': self.rststyle('emphasis')}) diff --git a/docutils/test/functional/expected/odt_classifier.odt b/docutils/test/functional/expected/odt_classifier.odt Binary files differnew file mode 100644 index 000000000..580a9133d --- /dev/null +++ b/docutils/test/functional/expected/odt_classifier.odt diff --git a/docutils/test/functional/input/odt_classifier.txt b/docutils/test/functional/input/odt_classifier.txt new file mode 100644 index 000000000..f1aecbe12 --- /dev/null +++ b/docutils/test/functional/input/odt_classifier.txt @@ -0,0 +1,13 @@ +Definition Lists +---------------- + +Term + Definition +Term : classifier + Definition paragraph 1. + + Definition paragraph 2. +Term + Definition + + diff --git a/docutils/test/test_writers/test_odt.py b/docutils/test/test_writers/test_odt.py index 9f1fa7be3..a7a033792 100755 --- a/docutils/test/test_writers/test_odt.py +++ b/docutils/test/test_writers/test_odt.py @@ -202,6 +202,9 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase): def test_odt_contents(self): self.process_test('odt_contents.txt', 'odt_contents.odt') + def test_odt_classifier(self): + self.process_test('odt_classifier.txt', 'odt_classifier.odt') + # # Template for new tests. # Also add functional/input/odt_xxxx.txt and |
