summaryrefslogtreecommitdiff
path: root/docutils/test/DocutilsTestSupport.py
diff options
context:
space:
mode:
authoraa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-11-02 23:28:49 +0000
committeraa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-11-02 23:28:49 +0000
commit4852d5531887dc0ed028ac48b256a5f8ca2db196 (patch)
tree9f0b614b3044dcb47c0935bbb97036a13e2c1baf /docutils/test/DocutilsTestSupport.py
parent0c25e5e170c8f4b4ed08e917f6610dd229b1b64f (diff)
downloaddocutils-4852d5531887dc0ed028ac48b256a5f8ca2db196.tar.gz
Partially revert r9167
``docutils.core.publish_string`` uses Python 2 notion of a bytestring, such that in the general case it returns Python 3's ``bytes`` type. Revision 9167 attempted to address this distinction by introducing ``publish_bytes`` and changing ``publish_string`` to always return unicode text data as Python's ``str`` type. This is a backwards compatibility break, so in this commit we restore the previous behaviour, whilst simultaneously deprecating support for returning binary data from the ``docutils.core.publish_string`` function for at least two releases of Docutils. As part of this, we also deprecate returning binary data from the ``docutils.io.StringOutput.encode`` method, docutils.io.BytesOutput`` should be used in its stead. Finally, we update tests for the reversion to the previous behaviour. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9202 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/DocutilsTestSupport.py')
-rw-r--r--docutils/test/DocutilsTestSupport.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py
index ce515062c..496e68dd7 100644
--- a/docutils/test/DocutilsTestSupport.py
+++ b/docutils/test/DocutilsTestSupport.py
@@ -492,7 +492,8 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec):
"""
settings_default_overrides = {'_disable_config': True,
- 'strict_visitor': True}
+ 'strict_visitor': True,
+ 'output_encoding': 'unicode'}
writer_name = '' # set in subclasses or constructor
def __init__(self, *args, writer_name='', **kwargs):
@@ -508,7 +509,7 @@ class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec):
writer_name=self.writer_name,
settings_spec=self,
settings_overrides=self.suite_settings)
- self.assertEqual(output, str(self.expected))
+ self.assertEqual(str(output), str(self.expected))
class PublishTestSuite(CustomTestSuite):