Skip to content

Commit

Permalink
Updated test_unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
NicklasTegner authored and NicklasTegner committed Nov 15, 2021
1 parent 5926edd commit 6670e90
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests.py
Expand Up @@ -279,21 +279,21 @@ def test_unicode_input(self):
self.assertTrue(isinstance(written, unicode_type))

# Only use german umlauts in th next test, as iso-8859-15 covers that
expected = u'üäö€{0}'.format(os.linesep)
bytes = u'<p>üäö€</p>'.encode("iso-8859-15")
expected = u'äüäö{0}'.format(os.linesep)
bytes = u'<p>äüäö</p>'.encode("iso-8859-15")

# Without encoding, this fails as we expect utf-8 per default

def f():
pypandoc.convert_text(bytes, 'md', format='html')
written = pypandoc.convert_text(bytes, 'md', format='html')

self.assertRaises(RuntimeError, f)
assert expected != written

def f():
# we have to use something which interprets '\xa4', so latin and -1 does not work :-/
pypandoc.convert_text(bytes, 'md', format='html', encoding="utf-16")
written = pypandoc.convert_text(bytes, 'md', format='html', encoding="utf-16")

self.assertRaises(RuntimeError, f)
assert expected != written
# with the right encoding it should work...
written = pypandoc.convert_text(bytes, 'md', format='html', encoding="iso-8859-15")
self.assertEqualExceptForNewlineEnd(expected, written)
Expand Down

0 comments on commit 6670e90

Please sign in to comment.