3
3
# Author: Felix Wiemann
4
4
# Contact: Felix_Wiemann@ososo.de
5
# Revision: $Revision: 1.4 $
6
# Date: $Date: 2004/05/07 15:15:09 $
5
# Revision: $Revision: 3968 $
6
# Date: $Date: 2005-10-29 14:28:44 +0200 (Sat, 29 Oct 2005) $
7
7
# Copyright: This module has been placed in the public domain.
10
10
Test for docutils XML writer.
13
from __init__ import DocutilsTestSupport
16
16
import docutils.core
19
class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec):
21
input = 'Test\n====\n\nSubsection\n----------\n\nTest\n\n----------\n\nTest.'
19
class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase):
26
Test. \xc3\xa4\xc3\xb6\xc3\xbc\xe2\x82\xac"""
22
27
xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n'
23
doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/spec/docutils.dtd">\n'
28
doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n'
24
29
generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__
25
bodynormal = '<document id="test" name="test" source="<string>"><title>Test</title><subtitle id="subsection" name="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
26
bodynormal = '<document id="test" name="test" source="<string>"><title>Test</title><subtitle id="subsection" name="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
27
bodynewlines = '<document id="test" name="test" source="<string>">\n<title>\nTest\n</title>\n<subtitle id="subsection" name="subsection">\nSubsection\n</subtitle>\n<paragraph>\nTest\n</paragraph>\n<transition/>\n<paragraph>\nTest.\n</paragraph>\n</document>\n'
28
bodyindents = '<document id="test" name="test" source="<string>">\n <title>\n Test\n </title>\n <subtitle id="subsection" name="subsection">\n Subsection\n </subtitle>\n <paragraph>\n Test\n </paragraph>\n <transition/>\n <paragraph>\n Test.\n </paragraph>\n</document>\n'
30
settings_default_overrides = {'_disable_config': 1}
30
bodynormal = '<document source="<string>"><paragraph>Test</paragraph><transition/><paragraph>Test. \xe4\xf6\xfc€</paragraph></document>'
32
<document source="<string>">
38
Test. \xe4\xf6\xfc€
43
<document source="<string>">
49
Test. \xe4\xf6\xfc€
32
54
def test_publish(self):
33
settings = {'output_encoding': 'iso-8859-1'}
55
settings = {'input_encoding': 'utf8',
56
'output_encoding': 'iso-8859-1',
34
58
for settings['newlines'] in 0, 1:
35
59
for settings['indents'] in 0, 1:
36
60
for settings['xml_declaration'] in 0, 1:
53
77
(source=self.input,
54
78
reader_name='standalone',
55
79
writer_name='docutils_xml',
57
80
settings_overrides=settings),
61
84
if __name__ == '__main__':