validators: fixup doctests after adding unicode_literals

This commit is contained in:
Cosimo Lupo 2018-07-14 19:42:16 +01:00
parent 0951e2063e
commit b44e3d5087
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482
2 changed files with 16 additions and 10 deletions

View File

@ -952,21 +952,26 @@ def fontLibValidator(value):
>>> fontLibValidator(lib) >>> fontLibValidator(lib)
(True, None) (True, None)
>>> lib = {"public.glyphOrder" : [u"A", u"C", u"B"]}
>>> fontLibValidator(lib)
(True, None)
>>> lib = "hello" >>> lib = "hello"
>>> fontLibValidator(lib) >>> valid, msg = fontLibValidator(lib)
(False, 'The lib data is not in the correct format: expected a dictionary, found str') >>> valid
False
>>> print(msg) # doctest: +ELLIPSIS
The lib data is not in the correct format: expected a dictionary, ...
>>> lib = {1: "hello"} >>> lib = {1: "hello"}
>>> fontLibValidator(lib) >>> valid, msg = fontLibValidator(lib)
(False, 'The lib key is not properly formatted: expected basestring, found int: 1') >>> valid
False
>>> print(msg)
The lib key is not properly formatted: expected basestring, found int: 1
>>> lib = {"public.glyphOrder" : "hello"} >>> lib = {"public.glyphOrder" : "hello"}
>>> fontLibValidator(lib) >>> valid, msg = fontLibValidator(lib)
(False, 'public.glyphOrder is not properly formatted: expected list or tuple, found str') >>> valid
False
>>> print(msg) # doctest: +ELLIPSIS
public.glyphOrder is not properly formatted: expected list or tuple,...
>>> lib = {"public.glyphOrder" : ["A", 1, "B"]} >>> lib = {"public.glyphOrder" : ["A", 1, "B"]}
>>> fontLibValidator(lib) >>> fontLibValidator(lib)

View File

@ -40,6 +40,7 @@ license_file = LICENSE.txt
minversion = 3.0.2 minversion = 3.0.2
testpaths = testpaths =
ufoLib ufoLib
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES
addopts = addopts =
-r a -r a
--doctest-modules --doctest-modules