testTools¶
Helpers for writing unit tests.
-
class
fontTools.misc.testTools.
MockFont
[source]¶ A font-like object that automatically adds any looked up glyphname to its glyphOrder.
-
fontTools.misc.testTools.
getXML
(func, ttFont=None)[source]¶ Call the passed toXML function and return the written content as a list of lines (unicode strings). Result is stripped of XML declaration and OS-specific newline characters.
-
fontTools.misc.testTools.
parseXML
(xmlSnippet)[source]¶ Parses a snippet of XML.
Input can be either a single string (unicode or UTF-8 bytes), or a a sequence of strings.
The result is in the same format that would be returned by XMLReader, but the parser imposes no constraints on the root element so it can be called on small snippets of TTX files.