testTools
Helpers for writing unit tests.
- 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.
- 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.stripVariableItemsFromTTX(string: str, ttLibVersion: bool = True, checkSumAdjustment: bool = True, modified: bool = True, created: bool = True, sfntVersion: bool = False) str [source]
Strip stuff like ttLibVersion, checksums, timestamps, etc. from TTX dumps.