[_k_e_r_n_test] rewrite as pytest-style; fix indentation
This commit is contained in:
parent
045287aa25
commit
240ef765a8
@ -1,8 +1,8 @@
|
|||||||
from __future__ import print_function, absolute_import
|
from __future__ import print_function, absolute_import
|
||||||
from fontTools.misc.py23 import *
|
from fontTools.misc.py23 import *
|
||||||
from fontTools import ttLib
|
|
||||||
import unittest
|
|
||||||
from fontTools.ttLib.tables._k_e_r_n import KernTable_format_0
|
from fontTools.ttLib.tables._k_e_r_n import KernTable_format_0
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
class MockFont(object):
|
class MockFont(object):
|
||||||
|
|
||||||
@ -12,19 +12,22 @@ class MockFont(object):
|
|||||||
def getGlyphName(self, glyphID):
|
def getGlyphName(self, glyphID):
|
||||||
return "glyph%.5d" % glyphID
|
return "glyph%.5d" % glyphID
|
||||||
|
|
||||||
class KernTable_format_0_Test(unittest.TestCase):
|
|
||||||
|
class KernTable_format_0_Test(object):
|
||||||
|
|
||||||
def test_decompileBadGlyphId(self):
|
def test_decompileBadGlyphId(self):
|
||||||
subtable = KernTable_format_0()
|
subtable = KernTable_format_0()
|
||||||
subtable.apple = False
|
subtable.apple = False
|
||||||
subtable.decompile( b'\x00' * 6
|
subtable.decompile(
|
||||||
+ b'\x00' + b'\x02' + b'\x00' * 6
|
b'\x00' * 6 +
|
||||||
+ b'\x00' + b'\x01' + b'\x00' + b'\x03' + b'\x00' + b'\x01'
|
b'\x00' + b'\x02' + b'\x00' * 6 +
|
||||||
+ b'\x00' + b'\x01' + b'\xFF' + b'\xFF' + b'\x00' + b'\x02',
|
b'\x00' + b'\x01' + b'\x00' + b'\x03' + b'\x00' + b'\x01' +
|
||||||
|
b'\x00' + b'\x01' + b'\xFF' + b'\xFF' + b'\x00' + b'\x02',
|
||||||
MockFont())
|
MockFont())
|
||||||
self.assertEqual(subtable[("glyph00001", "glyph00003")], 1)
|
assert subtable[("glyph00001", "glyph00003")] == 1
|
||||||
self.assertEqual(subtable[("glyph00001", "glyph65535")], 2)
|
assert subtable[("glyph00001", "glyph65535")] == 2
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
sys.exit(unittest.main())
|
sys.exit(pytest.main(sys.argv))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user