mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-13 10:42:17 -04:00
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:
@@ -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]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user