diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-03-04 10:07:58 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-03-04 10:07:58 +0000 |
commit | e1998a914a538b41956951572b80c098c0293d22 (patch) | |
tree | 1b7371a016a532d9009bbe160f70f73c1cd0da78 | |
parent | 08bd7ec16b5d0c1358e3db04b4aa257d9e77b90a (diff) | |
download | docutils-e1998a914a538b41956951572b80c098c0293d22.tar.gz |
Test case for io.Input.decode with "unicode" data. Cf. bug [ 3606659 ].
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7620 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rwxr-xr-x | test/test_io.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/test_io.py b/test/test_io.py index 602d4ef81..03b992c21 100755 --- a/test/test_io.py +++ b/test/test_io.py @@ -119,10 +119,18 @@ print "hello world" if input.successful_encoding == 'latin-1': self.assertEqual(data, u'Gr\xfc\xdfe\n') + def test_decode_unicode(self): + # With the special value "unicode" or "Unicode": + uniinput = io.Input(encoding='unicode') + # keep unicode instances as-is + self.assertEqual(uniinput.decode(u'ja'), u'ja') + # raise AssertionError if data is not an unicode string + self.assertRaises(AssertionError, uniinput.decode, bytes('ja')) + class OutputTests(unittest.TestCase): - bdata = b('\xfc') + bdata = bytes('\xfc') udata = u'\xfc' def setUp(self): |