Some more fixes for the unicode type

Now replaced in all dynamically loaded code. Recipes/metadata
sources/etc. In the case of recipes, since they get compiled by calibre
we simply make the unicode/unichr names available, no need for any
changes to the actual recipes themselves.
This commit is contained in:
Kovid Goyal
2019-03-13 12:04:09 +05:30
parent 6ad22b392b
commit 2d21a8efa2
33 changed files with 158 additions and 154 deletions
+2 -7
View File
@@ -8,10 +8,6 @@ __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import unittest
try:
unicode
except NameError:
unicode = str
def jsonify(tokens):
"""Turn tokens into "JSON-compatible" data structures."""
@@ -24,6 +20,7 @@ def jsonify(tokens):
else:
yield token.type, token.value
class BaseTest(unittest.TestCase):
longMessage = True
@@ -34,10 +31,8 @@ class BaseTest(unittest.TestCase):
"""Test not complete error messages but only substrings."""
self.ae(len(errors), len(expected_errors))
for error, expected in zip(errors, expected_errors):
self.assertIn(expected, unicode(error))
self.assertIn(expected, type(u'')(error))
def jsonify_declarations(self, rule):
return [(decl.name, list(jsonify(decl.value)))
for decl in rule.declarations]