/usr/lib/python3/dist-packages/defcon/test/objects/test_kerning.py is in python3-defcon 0.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | import unittest
from defcon.test.testTools import getTestFontPath
from defcon.objects.font import Font
class KerningTest(unittest.TestCase):
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)
if not hasattr(self, "assertRaisesRegex"):
self.assertRaisesRegex = self.assertRaisesRegexp
def test_keys(self):
font = Font(getTestFontPath())
self.assertEqual(sorted(font.kerning.keys()),
[("A", "A"), ("A", "B")])
def test_items(self):
font = Font(getTestFontPath())
self.assertEqual(sorted(font.kerning.items()),
[(("A", "A"), -100), (("A", "B"), 100)])
def test_values(self):
font = Font(getTestFontPath())
self.assertEqual(sorted(font.kerning.values()),
[-100, 100])
def test___contains__(self):
font = Font(getTestFontPath())
self.assertIn(("A", "B"), font.kerning)
self.assertNotIn(("NotInFont", "NotInFont"), font.kerning)
def test_get(self):
font = Font(getTestFontPath())
self.assertEqual(font.kerning.get(("A", "A")), -100)
self.assertEqual(font.kerning.get(("NotInFont", "NotInFont"), 0), 0)
def test___getitem__(self):
font = Font(getTestFontPath())
self.assertEqual(font.kerning["A", "A"], -100)
with self.assertRaisesRegex(KeyError, "\('NotInFont', 'NotInFont'\)"):
font.kerning["NotInFont", "NotInFont"]
def test___setitem__(self):
font = Font(getTestFontPath())
font.kerning["NotInFont", "NotInFont"] = 100
self.assertEqual(sorted(font.kerning.keys()),
[("A", "A"), ("A", "B"), ("NotInFont", "NotInFont")])
self.assertTrue(font.kerning.dirty)
def test_clear(self):
font = Font(getTestFontPath())
font.kerning.clear()
self.assertEqual(list(font.kerning.keys()), [])
self.assertTrue(font.kerning.dirty)
def test_update(self):
font = Font(getTestFontPath())
other = {("X", "X"): 500}
font.kerning.update(other)
self.assertEqual(sorted(font.kerning.keys()),
[("A", "A"), ("A", "B"), ("X", "X")])
self.assertTrue(font.kerning.dirty)
if __name__ == "__main__":
unittest.main()
|