summaryrefslogtreecommitdiff
path: root/docutils/test/test_parsers/test_parser.py
diff options
context:
space:
mode:
authorgbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2009-04-01 20:00:21 +0000
committergbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2009-04-01 20:00:21 +0000
commit069193bfb868995efddf3d623d7128d2d63fda1c (patch)
treeff6e815b7969aac2e2bffddc4ef6d99c9df43ca4 /docutils/test/test_parsers/test_parser.py
parent7422fd625d008f8d73350ac03686927263b25c22 (diff)
downloaddocutils-069193bfb868995efddf3d623d7128d2d63fda1c.tar.gz
Convert docutils to Python 3 (at least so that it runs the test suite.)
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5889 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/test_parsers/test_parser.py')
-rw-r--r--docutils/test/test_parsers/test_parser.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/docutils/test/test_parsers/test_parser.py b/docutils/test/test_parsers/test_parser.py
index 1d684bdad..bd305d9da 100644
--- a/docutils/test/test_parsers/test_parser.py
+++ b/docutils/test/test_parsers/test_parser.py
@@ -8,11 +8,12 @@
Tests for basic functionality of parser classes.
"""
+import sys
import unittest
import DocutilsTestSupport # must be imported before docutils
import docutils
from docutils import parsers, utils, frontend
-
+from docutils._compat import b
class RstParserTests(unittest.TestCase):
@@ -23,8 +24,13 @@ class RstParserTests(unittest.TestCase):
document = utils.new_document('test data', frontend.OptionParser(
components=(parser, )).get_default_values())
- self.assertRaises(UnicodeError, # UnicodeDecodeError since py2.3
- parser.parse, 'hol%s' % chr(224), document)
+ if sys.version_info < (3,):
+ # supplying string input is supported, but only if ascii-decodable
+ self.assertRaises(UnicodeError, # UnicodeDecodeError since py2.3
+ parser.parse, b('hol%s' % chr(224)), document)
+ else:
+ # input must be unicode at all times
+ self.assertRaises(TypeError, parser.parse, b('hol'), document)
if __name__ == '__main__':