From 3bfb093457dd422ac030226ea868df4cc31a3067 Mon Sep 17 00:00:00 2001 From: wiemann Date: Wed, 21 Mar 2007 02:43:26 +0000 Subject: replaced 'raw_unicode_escape' with 'ascii', 'backslashreplace' so we don't get latin1 strings git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5032 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/test/DocutilsTestSupport.py | 8 ++++---- docutils/test/test_language.py | 4 ++-- docutils/test/test_nodes.py | 2 +- docutils/test/test_parsers/test_rst/test_directives/test_raw.py | 6 +++--- docutils/test/test_parsers/test_rst/test_enumerated_lists.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'docutils/test') diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py index 24858c624..5339c9213 100644 --- a/docutils/test/DocutilsTestSupport.py +++ b/docutils/test/DocutilsTestSupport.py @@ -191,11 +191,11 @@ class CustomTestCase(StandardTestCase): def compare_output(self, input, output, expected): """`input`, `output`, and `expected` should all be strings.""" if isinstance(input, UnicodeType): - input = input.encode('raw_unicode_escape') + input = input.encode('ascii', 'backslashreplace') if isinstance(output, UnicodeType): - output = output.encode('raw_unicode_escape') + output = output.encode('ascii', 'backslashreplace') if isinstance(expected, UnicodeType): - expected = expected.encode('raw_unicode_escape') + expected = expected.encode('ascii', 'backslashreplace') try: self.assertEquals(output, expected) except AssertionError, error: @@ -807,7 +807,7 @@ class HtmlWriterPublishPartsTestCase(WriterPublishTestCase): output = [] for key in keys: output.append("%r: '''%s'''" - % (key, parts[key].encode('raw_unicode_escape'))) + % (key, parts[key].encode('ascii', 'backslashreplace'))) if output[-1].endswith("\n'''"): output[-1] = output[-1][:-4] + "\\n'''" return '{' + ',\n '.join(output) + '}\n' diff --git a/docutils/test/test_language.py b/docutils/test/test_language.py index 3f929bd05..49f70e8a5 100755 --- a/docutils/test/test_language.py +++ b/docutils/test/test_language.py @@ -146,7 +146,7 @@ class LanguageTestCase(DocutilsTestSupport.CustomTestCase): text = ('Module docutils.parsers.rst.languages.%s:\n %s' % (self.language, '\n '.join(failures))) if type(text) == UnicodeType: - text = text.encode('raw_unicode_escape') + text = text.encode('ascii', 'backslashreplace') self.fail(text) def test_roles(self): @@ -181,7 +181,7 @@ class LanguageTestCase(DocutilsTestSupport.CustomTestCase): text = ('Module docutils.parsers.rst.languages.%s:\n %s' % (self.language, '\n '.join(failures))) if type(text) == UnicodeType: - text = text.encode('raw_unicode_escape') + text = text.encode('ascii', 'backslashreplace') self.fail(text) diff --git a/docutils/test/test_nodes.py b/docutils/test/test_nodes.py index 5c419f09b..6ad2f19d6 100755 --- a/docutils/test/test_nodes.py +++ b/docutils/test/test_nodes.py @@ -31,7 +31,7 @@ class TextTests(unittest.TestCase): def test_unicode(self): self.assertEquals(unicode(self.unicode_text), u'Möhren') - self.assertEquals(str(self.unicode_text), 'M\xf6hren') + self.assertEquals(str(self.unicode_text), 'M\\xf6hren') def test_astext(self): self.assertEquals(self.text.astext(), 'Line 1.\nLine 2.') diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_raw.py b/docutils/test/test_parsers/test_rst/test_directives/test_raw.py index 63cee274f..80b45d1fb 100755 --- a/docutils/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/docutils/test/test_parsers/test_rst/test_directives/test_raw.py @@ -96,10 +96,10 @@ totest['raw'] = [ "Treat", "Quantity", "Description" - "Albatr\xb0\xdf", 2.99, "\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!" - "Crunchy Frog", 1.49, "If we took the b\xf6nes out, it wouldn\\u2019t be + "Albatr\\xb0\\xdf", 2.99, "\\xa1On a \\u03c3\\u03c4\\u03b9\\u03ba!" + "Crunchy Frog", 1.49, "If we took the b\\xf6nes out, it wouldn\\u2019t be crunchy, now would it?" - "Gannet Ripple", 1.99, "\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" + "Gannet Ripple", 1.99, "\\xbfOn a \\u03c3\\u03c4\\u03b9\\u03ba?" """ % utf_16_file_rel], ["""\ Raw input file is UTF-16-encoded, and is not valid ASCII. diff --git a/docutils/test/test_parsers/test_rst/test_enumerated_lists.py b/docutils/test/test_parsers/test_rst/test_enumerated_lists.py index 38bf2268c..f5177122f 100755 --- a/docutils/test/test_parsers/test_rst/test_enumerated_lists.py +++ b/docutils/test/test_parsers/test_rst/test_enumerated_lists.py @@ -679,7 +679,7 @@ Princeton, NJ. Using a non-breaking space as a workaround: - A.\xa0Einstein was a great influence on + A.\\xa0Einstein was a great influence on B. Physicist, who was a colleague of C. Chemist. They all worked in Princeton, NJ. -- cgit v1.2.1