Ejemplo n.º 1
0
def test_xml_from_xml(testfile, tableTag):
    """Check XML from object read from XML."""
    _skip_if_requirement_missing(testfile)

    xml_expected = read_expected_ttx(testfile, tableTag)

    font = load_ttx(xml_expected)
    name = os.path.splitext(testfile)[0]
    setupfile = getpath("%s.ttx.%s.setup" % (name, tagToXML(tableTag)))
    if os.path.exists(setupfile):
        #        import pdb; pdb.set_trace()
        font.importXML(setupfile)
    xml_from_xml = dump_ttx(font, tableTag)

    assert xml_expected == xml_from_xml
Ejemplo n.º 2
0
def test_xml_from_xml(testfile, tableTag):
    """Check XML from object read from XML."""
    _skip_if_requirement_missing(testfile)

    xml_expected = read_expected_ttx(testfile, tableTag)

    font = load_ttx(xml_expected)
    name = os.path.splitext(testfile)[0]
    setupfile = getpath("%s.ttx.%s.setup" % (name, tagToXML(tableTag)))
    if os.path.exists(setupfile):
#        import pdb; pdb.set_trace()
        font.importXML(setupfile)
    xml_from_xml = dump_ttx(font, tableTag)

    assert xml_expected == xml_from_xml
Ejemplo n.º 3
0
def read_expected_ttx(testfile, tableTag):
    name = os.path.splitext(testfile)[0]
    xml_expected_path = getpath("%s.ttx.%s" % (name, tagToXML(tableTag)))
    with open(xml_expected_path, 'r', encoding="utf-8") as xml_file:
        xml_expected = ttLibVersion_RE.sub('', xml_file.read())
    return xml_expected
Ejemplo n.º 4
0
def read_expected_ttx(testfile, tableTag):
    name = os.path.splitext(testfile)[0]
    xml_expected_path = getpath("%s.ttx.%s" % (name, tagToXML(tableTag)))
    with open(xml_expected_path, 'r', encoding="utf-8") as xml_file:
        xml_expected = ttLibVersion_RE.sub('', xml_file.read())
    return xml_expected