File: test_html4css1_misc.py

package info (click to toggle)
python-docutils 0.5-2%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 5,664 kB
  • ctags: 3,475
  • sloc: python: 31,530; lisp: 3,348; sh: 1,966; makefile: 147
file content (34 lines) | stat: -rwxr-xr-x 1,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env python

# $Id: test_html4css1_misc.py 5174 2007-05-31 00:01:52Z wiemann $
# Author: Lea Wiemann <LeWiemann@gmail.com>
# Copyright: This module has been placed in the public domain.

"""
Miscellaneous HTML writer tests.
"""

from __init__ import DocutilsTestSupport
from docutils import core


class EncodingTestCase(DocutilsTestSupport.StandardTestCase):

    def test_xmlcharrefreplace(self):
        # Test that xmlcharrefreplace is the default output encoding
        # error handler.
        settings_overrides={
            'output_encoding': 'latin1',
            'stylesheet': '',
            '_disable_config': 1,}
        result = core.publish_string(
            'EUR = \xe2\x82\xac', writer_name='html4css1',
            settings_overrides=settings_overrides)
        # Encoding a euro sign with latin1 doesn't work, so the
        # xmlcharrefreplcae handler is used.
        self.assert_(result.find('EUR = &#8364;') != -1)


if __name__ == '__main__':
    import unittest
    unittest.main()