1from fontTools.feaLib import ast 2import unittest 3 4 5class AstTest(unittest.TestCase): 6 def test_glyphname_escape(self): 7 statement = ast.GlyphClass() 8 for name in ("BASE", "NULL", "foo", "a"): 9 statement.append(ast.GlyphName(name)) 10 self.assertEqual(statement.asFea(), r"[\BASE \NULL foo a]") 11 12 def test_valuerecord_none(self): 13 statement = ast.ValueRecord(xPlacement=10, xAdvance=20) 14 self.assertEqual(statement.asFea(), "<10 0 20 0>") 15 16 def test_non_object_location(self): 17 el = ast.Element(location=("file.fea", 1, 2)) 18 self.assertEqual(el.location.file, "file.fea") 19 self.assertEqual(el.location.line, 1) 20 self.assertEqual(el.location.column, 2) 21 22 23if __name__ == "__main__": 24 import sys 25 sys.exit(unittest.main()) 26