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