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

View File

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