formatting with black to get lint to pass
This commit is contained in:
parent
45d1d01f66
commit
9656e3faf1
@ -250,7 +250,9 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False):
|
||||
|
||||
# m0idx should be the index of the first non-None item in allNodeTypes,
|
||||
# else give it the first index of None, which is likely 0
|
||||
m0idx = allNodeTypes.index(next((x for x in allNodeTypes if x is not None), None))
|
||||
m0idx = allNodeTypes.index(
|
||||
next((x for x in allNodeTypes if x is not None), None)
|
||||
)
|
||||
# m0 is the first non-None item in allNodeTypes, or the first item if all are None
|
||||
m0 = allNodeTypes[m0idx]
|
||||
for i, m1 in enumerate(allNodeTypes[m0idx + 1 :]):
|
||||
@ -303,7 +305,9 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False):
|
||||
|
||||
# m0idx should be the index of the first non-None item in allVectors,
|
||||
# else give it the first index of None, which is likely 0
|
||||
m0idx = allVectors.index(next((x for x in allVectors if x is not None), None))
|
||||
m0idx = allVectors.index(
|
||||
next((x for x in allVectors if x is not None), None)
|
||||
)
|
||||
# m0 is the first non-None item in allVectors, or the first item if all are None
|
||||
m0 = allVectors[m0idx]
|
||||
for i, m1 in enumerate(allVectors[m0idx + 1 :]):
|
||||
@ -336,7 +340,9 @@ def test(glyphsets, glyphs=None, names=None, ignore_missing=False):
|
||||
|
||||
# m0idx should be the index of the first non-None item in allContourIsomorphisms,
|
||||
# else give it the first index of None, which is likely 0
|
||||
m0idx = allContourIsomorphisms.index(next((x for x in allContourIsomorphisms if x is not None), None))
|
||||
m0idx = allContourIsomorphisms.index(
|
||||
next((x for x in allContourIsomorphisms if x is not None), None)
|
||||
)
|
||||
# m0 is the first non-None item in allContourIsomorphisms, or the first item if all are None
|
||||
m0 = allContourIsomorphisms[m0idx]
|
||||
for i, m1 in enumerate(allContourIsomorphisms[m0idx + 1 :]):
|
||||
@ -397,7 +403,11 @@ def main(args=None):
|
||||
help="Will not report glyphs missing from sparse masters as errors",
|
||||
)
|
||||
parser.add_argument(
|
||||
"inputs", metavar="FILE", type=str, nargs="+", help="Input a single DesignSpace/Glyphs file, or multiple TTF/UFO files"
|
||||
"inputs",
|
||||
metavar="FILE",
|
||||
type=str,
|
||||
nargs="+",
|
||||
help="Input a single DesignSpace/Glyphs file, or multiple TTF/UFO files",
|
||||
)
|
||||
|
||||
args = parser.parse_args(args)
|
||||
@ -489,7 +499,9 @@ def main(args=None):
|
||||
for gn in diff:
|
||||
glyphset[gn] = None
|
||||
|
||||
problems = test(glyphsets, glyphs=glyphs, names=names, ignore_missing=args.ignore_missing)
|
||||
problems = test(
|
||||
glyphsets, glyphs=glyphs, names=names, ignore_missing=args.ignore_missing
|
||||
)
|
||||
|
||||
if not args.quiet:
|
||||
if args.json:
|
||||
|
@ -133,17 +133,37 @@ class InterpolatableTest(unittest.TestCase):
|
||||
|
||||
# without --ignore-missing
|
||||
problems = interpolatable_main(["--quiet"] + ttf_paths)
|
||||
self.assertEqual(problems['a'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['s'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['edotabove'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['dotabovecomb'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(
|
||||
problems["a"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["s"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["edotabove"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["dotabovecomb"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
|
||||
# normal order, with --ignore-missing
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + ttf_paths))
|
||||
# purposely putting the sparse master (medium) first
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + [ttf_paths[1]] + [ttf_paths[0]] + [ttf_paths[2]]))
|
||||
self.assertIsNone(
|
||||
interpolatable_main(
|
||||
["--ignore-missing"] + [ttf_paths[1]] + [ttf_paths[0]] + [ttf_paths[2]]
|
||||
)
|
||||
)
|
||||
# purposely putting the sparse master (medium) last
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + [ttf_paths[0]] + [ttf_paths[2]] + [ttf_paths[1]]))
|
||||
self.assertIsNone(
|
||||
interpolatable_main(
|
||||
["--ignore-missing"] + [ttf_paths[0]] + [ttf_paths[2]] + [ttf_paths[1]]
|
||||
)
|
||||
)
|
||||
|
||||
def test_sparse_interpolatable_ufos(self):
|
||||
ttx_dir = self.get_test_input("master_ufo")
|
||||
@ -151,26 +171,58 @@ class InterpolatableTest(unittest.TestCase):
|
||||
|
||||
# without --ignore-missing
|
||||
problems = interpolatable_main(["--quiet"] + ufo_paths)
|
||||
self.assertEqual(problems['a'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['s'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['edotabove'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['dotabovecomb'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(
|
||||
problems["a"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["s"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["edotabove"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["dotabovecomb"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
|
||||
# normal order, with --ignore-missing
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + ufo_paths))
|
||||
# purposely putting the sparse master (medium) first
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + [ufo_paths[1]] + [ufo_paths[0]] + [ufo_paths[2]]))
|
||||
self.assertIsNone(
|
||||
interpolatable_main(
|
||||
["--ignore-missing"] + [ufo_paths[1]] + [ufo_paths[0]] + [ufo_paths[2]]
|
||||
)
|
||||
)
|
||||
# purposely putting the sparse master (medium) last
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing"] + [ufo_paths[0]] + [ufo_paths[2]] + [ufo_paths[1]]))
|
||||
self.assertIsNone(
|
||||
interpolatable_main(
|
||||
["--ignore-missing"] + [ufo_paths[0]] + [ufo_paths[2]] + [ufo_paths[1]]
|
||||
)
|
||||
)
|
||||
|
||||
def test_sparse_designspace(self):
|
||||
designspace_path = self.get_test_input("SparseMasters_ufo.designspace")
|
||||
|
||||
problems = interpolatable_main(["--quiet", designspace_path])
|
||||
self.assertEqual(problems['a'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['s'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['edotabove'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(problems['dotabovecomb'], [{'type': 'missing', 'master': 'SparseMasters-Medium'}])
|
||||
self.assertEqual(
|
||||
problems["a"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["s"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["edotabove"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["dotabovecomb"],
|
||||
[{"type": "missing", "master": "SparseMasters-Medium"}],
|
||||
)
|
||||
|
||||
# normal order, with --ignore-missing
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing", designspace_path]))
|
||||
@ -179,15 +231,26 @@ class InterpolatableTest(unittest.TestCase):
|
||||
glyphsapp_path = self.get_test_input("SparseMasters.glyphs")
|
||||
|
||||
problems = interpolatable_main(["--quiet", glyphsapp_path])
|
||||
self.assertEqual(problems['a'], [{'type': 'missing', 'master': 'Sparse Masters-Medium'}])
|
||||
self.assertEqual(problems['s'], [{'type': 'missing', 'master': 'Sparse Masters-Medium'}])
|
||||
self.assertEqual(problems['edotabove'], [{'type': 'missing', 'master': 'Sparse Masters-Medium'}])
|
||||
self.assertEqual(problems['dotabovecomb'], [{'type': 'missing', 'master': 'Sparse Masters-Medium'}])
|
||||
self.assertEqual(
|
||||
problems["a"],
|
||||
[{"type": "missing", "master": "Sparse Masters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["s"],
|
||||
[{"type": "missing", "master": "Sparse Masters-Medium"}]
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["edotabove"],
|
||||
[{"type": "missing", "master": "Sparse Masters-Medium"}],
|
||||
)
|
||||
self.assertEqual(
|
||||
problems["dotabovecomb"],
|
||||
[{"type": "missing", "master": "Sparse Masters-Medium"}],
|
||||
)
|
||||
|
||||
# normal order, with --ignore-missing
|
||||
self.assertIsNone(interpolatable_main(["--ignore-missing", glyphsapp_path]))
|
||||
|
||||
|
||||
def test_interpolatable_varComposite(self):
|
||||
input_path = self.get_test_input(
|
||||
"..", "..", "ttLib", "data", "varc-ac00-ac01.ttf"
|
||||
|
Loading…
x
Reference in New Issue
Block a user