def test_report2():
    input_dir = get_input_path('font-family')
    expected_path = get_expected_path('font-family.txt')
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'd', '_{}'.format(input_dir),
                  'rm', 'rn', 'rp', 'l', '_{}'.format(log_path)])
    assert differ([expected_path, log_path, '-l', '1'])
def test_remove_overlap(args, ufo_filename, expct_label):
    actual_path = os.path.join(tempfile.mkdtemp(), ufo_filename)
    copytree(get_input_path(ufo_filename), actual_path)
    runner(CMD + ['-f', actual_path, '-o'] + args)
    expct_filename = '{}-{}'.format(ufo_filename[:-4], expct_label)
    expected_path = get_expected_path(expct_filename)
    assert differ([expected_path, actual_path])
Esempio n. 3
0
def test_font_with_outdated_hash_bug239():
    input_path = get_input_path('bug239/font_outdated_hash.ufo')
    output_path = get_temp_file_path()
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-o', 'f', '_{}'.format(input_path),
                            'o', '_{}'.format(output_path)])
    assert err.value.returncode == 1
def test_st28_basic_cmap():
    input_dir = get_input_path('basic_cmap')
    expected_path = get_expected_path('st28_basic_cmap.txt')
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'st', '_28', 'd', '_{}'.format(input_dir),
                  'l', '_{}'.format(log_path)])
    assert differ([expected_path, log_path, '-l', '1'])
Esempio n. 5
0
def test_build_options_cs_cl_bug459(args, input_filename, ttx_filename):
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'o', '_{}'.format(actual_path)] + args)
    actual_ttx = generate_ttx_dump(actual_path, ['cmap'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 6
0
def test_cff2_extract(args, exp_filename):
    # read CFF2 VF, write CFF2 table
    font_path = get_input_path('SourceCodeVariable-Roman.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-f', font_path, cff2_path, '-o', 'cff2'] + args)
    expected_path = get_expected_path(exp_filename)
    assert differ([expected_path, cff2_path, '-m', 'bin'])
Esempio n. 7
0
def test_recalculate_font_bbox_bug618(to_format, args, exp_filename):
    font_path = get_input_path('bug618.pfa')
    save_path = get_temp_file_path()

    runner(CMD + ['-f', font_path, save_path, '-o', to_format] + args)

    file_ext = to_format
    if to_format == 't1':
        file_ext = 'pfa'
    elif to_format == 'afm':
        file_ext = 'txt'

    expected_path = get_expected_path(
        'bug618/{}.{}'.format(exp_filename, file_ext))

    diff_mode = []
    if to_format == 'cff':
        diff_mode = ['-m', 'bin']

    skip = []
    if to_format == 'afm':
        skip = ['-s', 'Comment Creation Date:' + SPLIT_MARKER +
                'Comment Copyright']

    assert differ([expected_path, save_path] + diff_mode + skip)
def test_run_cli_with_output_path():
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'o', '_{}'.format(actual_path),
                  '_{}'.format(get_input_path(TEST_TTF_FILENAME))])
    actual_ttx = generate_ttx_dump(actual_path, ['maxp', 'glyf'])
    expected_ttx = get_expected_path('ttfcomponentizer.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
def test_cjk_var():
    """
    Builds all OTFs for the 'CJKVar' project and then diffs two of them.
    """
    input_dir = get_input_path('CJKVar')
    temp_dir = os.path.join(tempfile.mkdtemp(), 'CJKVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'CJKVar.designspace')
    runner(CMD + ['-o', '_{}'.format(ds_path)])

    otf1_path = os.path.join(
        temp_dir, 'Normal', 'Master_8', 'MasterSet_Kanji-w600.00.otf')
    otf2_path = os.path.join(
        temp_dir, 'Condensed', 'Master_8', 'MasterSet_Kanji_75-w600.00.otf')

    for otf_path in (otf1_path, otf2_path):
        actual_ttx = generate_ttx_dump(otf_path)
        expected_ttx = get_expected_path(
            os.path.basename(otf_path)[:-3] + 'ttx')
        assert differ([expected_ttx, actual_ttx,
                       '-s',
                       '<ttFont sfntVersion' + SPLIT_MARKER +
                       '    <checkSumAdjustment value=' + SPLIT_MARKER +
                       '    <created value=' + SPLIT_MARKER +
                       '    <modified value=',
                       '-r', r'^\s+Version.*;hotconv.*;makeotfexe'])
Esempio n. 10
0
def test_beztools_hhint_over_limit_bug629():
    test_filename = 'bug629.pfa'
    actual_path = get_temp_file_path()
    expected_path = get_expected_path(test_filename)
    runner(CMD + ['-o', 'nb', 'o', '_{}'.format(actual_path),
                  '-f', test_filename])
    assert differ([expected_path, actual_path,
                   '-s', r'%%Copyright: Copyright'])
Esempio n. 11
0
def test_linux_ci_failure_bug570():
    table_path = get_input_path('1_fdict.cff')
    font_path = get_input_path('core.otf')
    actual_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'a', '_CFF={}'.format(table_path),
                  '-f', font_path, actual_path])
    expected_path = get_expected_path('1_fdict.otf')
    assert differ([expected_path, actual_path, '-m', 'bin'])
Esempio n. 12
0
def test_report(font_family, font_format):
    input_dir = os.path.join(get_input_path(font_family), font_format)
    log_path = get_temp_file_path()
    runner(CMD + ['-o', 'd', '_{}'.format(input_dir), 'tolerance', '_3',
                  'rm', 'rn', 'rp', 'l', '_{}'.format(log_path)])
    expected_path = get_expected_path('{}_{}.txt'.format(
                                      font_family, font_format))
    assert differ([expected_path, log_path, '-l', '1'])
Esempio n. 13
0
def test_ufo_with_trailing_slash_bug280(input_filename):
    # makeotf will now save the OTF alongside the UFO instead of inside of it
    ufo_path = get_input_path(input_filename)
    temp_dir = tempfile.mkdtemp()
    tmp_ufo_path = os.path.join(temp_dir, input_filename)
    copytree(ufo_path, tmp_ufo_path)
    runner(CMD + ['-o', 'f', '_{}{}'.format(tmp_ufo_path, os.sep)])
    expected_path = os.path.join(temp_dir, OTF_NAME)
    assert os.path.isfile(expected_path)
Esempio n. 14
0
def test_output_is_folder_only_bug281(input_filename):
    # makeotf will output a default-named font to the folder
    input_path = get_input_path(input_filename)
    temp_dir = tempfile.mkdtemp()
    expected_path = os.path.join(temp_dir, OTF_NAME)
    assert os.path.exists(expected_path) is False
    runner(CMD + ['-o', 'f', '_{}'.format(input_path),
                        'o', '_{}'.format(temp_dir)])
    assert os.path.isfile(expected_path)
Esempio n. 15
0
def test_feature_includes_ufo_bug164():
    input_filename = "bug164/d1/d2/font.ufo"
    otf_path = get_temp_file_path()

    runner(CMD + ['-o',
                  'f', '_{}'.format(get_input_path(input_filename)),
                  'o', '_{}'.format(otf_path)])

    assert font_has_table(otf_path, 'head')
Esempio n. 16
0
def test_cff2_no_vf_bug353():
    # read CFF2 WITHOUT VF info, write a CFF2 out. 'regular_CFF2.otf'
    # is derived by taking the regular.otf file from the sfntdiff
    # 'input_data' directory, and converting the CFF table to CFF2.
    font_path = get_input_path('regular_CFF2.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    expected_path = get_expected_path('regular_CFF2.cff2')
    assert differ([expected_path, cff2_path, '-m', 'bin'])
Esempio n. 17
0
def test_outline_from_processed_layer_bug703():
    input_filename = 'bug703.ufo'
    ttx_filename = 'bug703.ttx'
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['CFF '])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 18
0
def test_options(args, ufo_filename, num):
    runner(['-t', TOOL, '-o', 'd',
            '_{}'.format(get_input_path('font.designspace')), 'i'] + args)
    if num:
        expct_filename = '{}{}.ufo'.format(ufo_filename[:-4], num)
    else:
        expct_filename = ufo_filename
    expected_path = _get_output_path(expct_filename, 'expected_output')
    actual_path = _get_output_path(ufo_filename, 'temp_output')
    assert differ([expected_path, actual_path])
Esempio n. 19
0
def test_mark_refer_diff_classes_bug416():
    input_filename = "bug416/font.pfa"
    feat_filename = "bug416/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug416.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 20
0
def test_many_hints_string_bug354():
    # The glyph T@gid002 has 33 hstem hints. This tests a bug where
    # tx defined an array of only 6 operands.
    # This is encountered only when wrinting to a VF CFF2.
    font_path = get_input_path('cff2_vf.otf')
    cff2_path = get_temp_file_path()
    dcf_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    runner(CMD + ['-a', '-o', 'dcf', '-f', cff2_path, dcf_path])
    expected_path = get_expected_path('cff2_vf.dcf.txt')
    assert differ([expected_path, dcf_path])
Esempio n. 21
0
def test_useMarkFilteringSet_flag_bug196():
    input_filename = "bug196/font.pfa"
    feat_filename = "bug196/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug196.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 22
0
def test_long_charstring_write():
    # read a CFF2 VF with a charstring longer that 65535, write out CFF2 file
    # NOTE: the font 'CJK-VarTest.otf' cannot be used in this test because
    # once its long charstring is optimized (floats -> ints) it's no longer
    # over the 65535 bytes limit; the long charstring in 'CJK-VarTest2.otf' is
    # already as small as possible, so it will trigger the check in cffwrite.c
    font_path = get_input_path('CJK-VarTest2.otf')
    cff2_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, cff2_path])
    expected_path = get_expected_path('CJK-VarTest2.cff2')
    assert differ([expected_path, cff2_path, '-m', 'bin'])
Esempio n. 23
0
def test_useException_bug321():
    input_filename = "bug321/font.pfa"
    feat_filename = "bug321/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug321.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB', 'GPOS'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 24
0
def test_contextual_multiple_substitutions_bug725():
    input_filename = "bug725/font.pfa"
    feat_filename = "bug725/feat.fea"
    actual_path = get_temp_file_path()
    ttx_filename = "bug725.ttx"
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GSUB'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 25
0
def test_cs_opt_bug684(filename):
    """ The input CFF2 variable font contains a long single charstring
    making the maximum use of the operand stack.
    tx was generating a bad CFF2 charstring that would overflow
    the operand stack of the standard size (513) after re-converted
    to CFF2 unless -no_opt option is specified."""
    font_path = get_input_path('{}.otf'.format(filename))
    result_path = get_temp_file_path()
    expected_path = get_expected_path('{}.cff2'.format(filename))
    runner(CMD + ['-a', '-o', 'cff2', '-f', font_path, result_path])
    assert differ([expected_path, result_path, '-m', 'bin'])
Esempio n. 26
0
def test_cjk_vf():
    input_dir = get_input_path('CJKVar')
    temp_dir = os.path.join(tempfile.mkdtemp(), 'CJKVar')
    copytree(input_dir, temp_dir)
    ds_path = os.path.join(temp_dir, 'CJKVar.designspace')
    runner(CMD + ['-o', 'p', '_{}'.format(ds_path)])
    actual_path = os.path.join(temp_dir, 'CJKVar.otf')
    actual_ttx = generate_ttx_dump(actual_path,
                                   ['CFF2', 'HVAR', 'avar', 'fvar'])
    expected_ttx = get_expected_path('CJKVar.ttx')
    assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])
Esempio n. 27
0
def test_delete_zero_kb_font_on_fail_bug736():
    input_filename = 'bug736/font.pfa'
    feat_filename = 'bug736/feat.fea'
    out_filename = 'bug736/SourceSans-Test.otf'

    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-o',
                      'f', '_{}'.format(get_input_path(input_filename)),
                      'ff', '_{}'.format(get_input_path(feat_filename))])
    assert err.value.returncode == 1
    assert os.path.exists(get_input_path(out_filename)) is False
Esempio n. 28
0
def test_GDEF_LigatureCaret_bug155(caret_format):
    input_filename = 'bug155/font.pfa'
    feat_filename = 'bug155/caret-{}.fea'.format(caret_format)
    ttx_filename = 'bug155/caret-{}.ttx'.format(caret_format)
    actual_path = get_temp_file_path()
    runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
                        'ff', '_{}'.format(get_input_path(feat_filename)),
                        'o', '_{}'.format(actual_path)])
    actual_ttx = generate_ttx_dump(actual_path, ['GDEF'])
    expected_ttx = get_expected_path(ttx_filename)
    assert differ([expected_ttx, actual_ttx, '-l', '2'])
Esempio n. 29
0
def test_no_psname_convert_to_type1_bug437(font_format):
    if 'cid' in font_format:
        file_ext = 'ps'
    elif 'ufo' in font_format:
        file_ext = 'ufo'
    else:
        file_ext = 'pfa'

    filename = '{}-noPSname.{}'.format(font_format, file_ext)
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-o', 't1', '-f', filename])
    assert err.value.returncode in (5, 6)
Esempio n. 30
0
def test_add_table():
    table_path = get_input_path('GDEF_italic.tb')
    font_path = get_input_path(ITALIC)
    actual_path = get_temp_file_path()
    assert font_has_table(font_path, 'GDEF') is False
    runner(CMD + ['-a', '-o', 'a', '_GDEF={}'.format(table_path),
                  '-f', font_path, actual_path])
    expected_path = get_expected_path('italic_w_GDEF.otf')
    assert differ([expected_path, actual_path, '-m', 'bin']) is False
    assert font_has_table(actual_path, 'GDEF')
    actual_ttx = generate_ttx_dump(actual_path)
    expected_ttx = generate_ttx_dump(expected_path)
    assert differ([expected_ttx, actual_ttx, '-s', '    <checkSumAdjustment'])
Esempio n. 31
0
def test_svg_missing_fontname_bug883(filename):
    font_path = get_input_path(filename)
    svg_path = get_temp_file_path()
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-a', '-o', 'svg', '-f', font_path, svg_path])
    assert (err.value.returncode == 6)  # exit code of 6, not segfault of -11
Esempio n. 32
0
def test_trademark_string_pr425():
    # the copyright symbol used in the trademark field of a UFO is
    # converted to 'Copyright' and stored in Notice field of a Type1
    actual_path = runner(CMD + ['-s', '-o', 't1', '-f', 'trademark.ufo'])
    expected_path = get_expected_path('trademark.pfa')
    assert differ([expected_path, actual_path])
Esempio n. 33
0
def test_long_charstring_read_bug444():
    # read a CFF2 VF with a charstring longer that 65535, check output
    actual_path = runner(CMD + ['-s', '-o', '0', '-f', 'CJK-VarTest.otf'])
    expected_path = get_expected_path('CJK-VarTest_read.txt')
    assert differ([expected_path, actual_path, '-s', '## Filename'])
Esempio n. 34
0
def test_glyph_bboxes_bug655():
    actual_path = runner(CMD + ['-s', '-o', 'mtx', '2', '-f', 'bug655.ufo'])
    expected_path = get_expected_path('bug655.txt')
    assert differ([expected_path, actual_path])
Esempio n. 35
0
def test_illegal_chars_in_glyph_name_bug473():
    font_path = get_input_path('bug473.ufo')
    save_path = get_temp_dir_path('bug473.ufo')
    runner(CMD + ['-a', '-o', 'ufo', '-f', font_path, save_path])
    expected_path = get_expected_path('bug473.ufo')
    assert differ([expected_path, save_path])
Esempio n. 36
0
def test_bug_940():
    input_path = get_bad_input_path('bug940_private_blend.otf')
    output_path = get_temp_file_path()
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-a', '-o', 'cff2', '-f', input_path, output_path])
    assert (err.value.returncode > 0)  # error code, not segfault or success
Esempio n. 37
0
def test_remove_hints_bug180():
    font_path = get_input_path('cid.otf')
    cid_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 't1', 'n', '-f', font_path, cid_path])
    expected_path = get_expected_path('cid_nohints.ps')
    assert differ([expected_path, cid_path, '-m', 'bin'])
Esempio n. 38
0
def test_too_many_glyphs_pr955():
    input_path = get_bad_input_path('TooManyGlyphsCFF2.otf')
    output_path = get_temp_file_path()
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-a', '-o', 'cff', '-f', input_path, output_path])
    assert (err.value.returncode > 0)  # error code, not hang or success
Esempio n. 39
0
def test_ufo3_guideline_bug705():
    actual_path = runner(CMD + ['-s', '-o', 't1', '-f', 'bug705.ufo'])
    expected_path = get_expected_path('bug705.pfa')
    assert differ([expected_path, actual_path] + ['-s'] + PFA_SKIP)
Esempio n. 40
0
def test_last_resort_instance_psname(vector, exp_filename):
    font_path = get_input_path('cff2_vf_many_axes.otf')
    output_path = get_temp_file_path()
    runner(CMD + ['-o', '0', 'U', f'_{vector}', '-f', font_path, output_path])
    expected_path = get_expected_path(exp_filename)
    assert differ([expected_path, output_path, '-s', '## Filename'])
Esempio n. 41
0
def test_bad_charset():
    font_path = get_bad_input_path('bad_charset.otf')
    save_path = get_temp_file_path()
    runner(CMD + ['-a', '-f', font_path, save_path])
    expected_path = get_expected_path('bad_charset.txt')
    assert differ([expected_path, save_path, '-s', '## Filename'])
Esempio n. 42
0
def test_unused_post2_names():
    font_path = get_input_path('SourceSansPro-Regular-cff2-unused-post.otf')
    save_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', '1', '-f', font_path, save_path])
    expected_path = get_expected_path('ssr-cff2-unused-post.txt')
    assert differ([expected_path, save_path, '-s', '## Filename'])
Esempio n. 43
0
def test_options(args, ufo_filename):
    runner(['-t', TOOL, '-o', 'd',
            f'_{get_input_path("font.designspace")}', 'i'] + args)
    expected_path = _get_output_path(ufo_filename, 'expected_output')
    actual_path = _get_output_path(ufo_filename, 'temp_output')
    assert differ([expected_path, actual_path])
Esempio n. 44
0
def test_type1_inputs(file_ext):
    bidf = '.bidf' if 'bidf' in file_ext else ''
    actual_path = runner(CMD + ['-s', '-o', '2', '-f', f'type1.{file_ext}'])
    expected_path = get_expected_path(f'type1.dump2{bidf}.txt')
    assert differ([expected_path, actual_path, '-s', '## Filename'])
Esempio n. 45
0
def test_run_cli_no_args():
    with pytest.raises(subprocess.CalledProcessError) as exc_info:
        runner(CMD)
    assert exc_info.value.returncode == 2
Esempio n. 46
0
learning_rate = 0.005
update_rate = 10000
loss = 'mse'
ma_threshold = 195

# Initialize environment
env_name = 'CartPole-v0'

if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument(
        '--model',
        default='ddqn',
        help=
        'DeepRL model to use (options: dqn_plain, dqn, ddqn; default: %(default)s)'
    )
    parser.add_argument(
        '--render-env',
        default='y',
        help='Whether to render the environment (default: %(default)s)')
    parser.add_argument(
        '--render-freq',
        type=int,
        default=100,
        help='How frequently to render the env (default: %(default)s) '
        '--render-env must be set to "y" to render environment')

    args = parser.parse_args()
    runner(env_name, memory_bank_size, batch_size, gamma, learning_rate,
           epsilon, epsilon_min, loss, n_episodes, ma_threshold, args)
Esempio n. 47
0
def test_ufo_read_processed_contents_plist_bug740(filename):
    actual_path = runner(
        CMD +
        ['-s', '-o', 'dump', '6', 'g', '_AE', '-f', f'bug740/{filename}.ufo'])
    expected_path = get_expected_path(f'bug740/{filename}.txt')
    assert differ([expected_path, actual_path])
Esempio n. 48
0
def test_missing_glyph_names_pr905_cef():
    input_path = get_bad_input_path('pr905.otf')
    output_path = get_temp_file_path()
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-a', '-o', 'cef', '-f', input_path, output_path])
    assert (err.value.returncode > 0)  # error code, not segfault of -11
Esempio n. 49
0
def test_varread_pr355():
    # read CFF2 VF, write Type1 snapshot
    actual_path = runner(CMD + ['-s', '-o', 't1', '-f', 'cff2_vf.otf'])
    expected_path = get_expected_path('cff2_vf.pfa')
    assert differ([expected_path, actual_path])
Esempio n. 50
0
def test_svg_with_cid_font_bug822():
    font_path = get_input_path('cid.otf')
    cid_path = get_temp_file_path()
    runner(CMD + ['-a', '-o', 'svg', '-f', font_path, cid_path])
    expected_path = get_expected_path('cid.svg')
    assert differ([expected_path, cid_path])
Esempio n. 51
0
def test_other_input_formats(fext):
    arg = ['y'] if fext == 'ttc' else []
    actual_path = runner(CMD + ['-s', '-f', f'font.{fext}', '-o', '3'] + arg)
    expected_path = get_expected_path(f'font.{fext}.dump3.txt')
    assert differ([expected_path, actual_path, '-s', '## Filename'])
Esempio n. 52
0
def test_ufo_vertical_advance_bug786():
    actual_path = runner(CMD + ['-s', '-o', 't1', '-f', 'bug786.ufo'])
    expected_path = get_expected_path('bug786.pfa')
    skip = ['-s'] + PFA_SKIP[:]
    assert differ([expected_path, actual_path] + skip)
Esempio n. 53
0
def test_dump_flex_op(fext):
    fname = 'flex'
    actual_path = runner(CMD + ['-s', '-o', '6', '-f', f'{fname}.{fext}'])
    expected_path = get_expected_path(f'{fname}.txt')
    assert differ([expected_path, actual_path])
Esempio n. 54
0
def test_filename_without_dir():
    instance_path = get_input_path('same_dir.ufo')
    assert not os.path.exists(instance_path)
    runner(['-t', TOOL, '-o', 'd',
            f'_{get_input_path("font.designspace")}', 'i', '_9'])
    assert os.path.exists(instance_path)
Esempio n. 55
0
    args.loss_function = 'mse'  # 'mse' / 'bce'
    args.hidden = 256
    args.mode = 'both'  # 'recon' / 'pred' / 'both'
    args.zero_input = False
    args.seed = 6
    args.recon_loss_lambda = 0.8
    args.optimizer = 'adam'  # 'rmsprop' / 'adam'
    args.learning_rate = 0.001
    args.is_init = True
    args.is_lr_scheduler = True
    args.lr_scheduler_inteval = 30
    args.lr_scheduler_gamma = 0.5
    args.gradiant_clip = 0.25
    args.is_show = True

    args.is_wandb = True
    return args


#///////////////////////////////////////////////////////

args = get_args()
args.is_cuda = False
args.is_quickrun = True
args.is_save = True
# args.mode = 'recon'
# args.optimizer = 'adam'
runner(args)
# for i in vars(args):
#     print('ARGS >>> ' + i + ' :{}'.format(vars(args)[i]))
Esempio n. 56
0
def test_standard_apple_glyph_names():
    actual_path = runner(CMD + ['-s', '-o', 'dump', '4', '-f', 'post-v2.ttf'])
    expected_path = get_expected_path('post-v2.txt')
    assert differ([expected_path, actual_path])
'''
Created on Apr 2, 2018

@author: Josh Elliott : [email protected]
'''

from runner import runner
from pipeline import pipeline
from matlab_function import matlab_function

if __name__ == '__main__':

    func1 = matlab_function('fibonacci')
    runner1 = runner(func1)
    func2 = matlab_function('factorial')
    runner2 = runner(func2)

    result = runner1.run(7)
    print(result)

    result = runner2.run(result)
    print(result)

    # Build a pipeline
    pipe = pipeline()
    pipe.add_step(runner1)
    pipe.add_step(runner2)

    # Run it
    result = pipe.run(7)
    print(result)
Esempio n. 58
0
def test_ufo_self_closing_dict_element_bug701():
    actual_path = runner(CMD + ['-s', '-o', 'dump', '0', '-f', 'bug701.ufo'])
    expected_path = get_expected_path('bug701.txt')
    assert differ([expected_path, actual_path, '-s', '## Filename'])
Esempio n. 59
0
def test_no_postscript_name_bug282(input_filename):
    # makeotf will fail for both UFO and Type 1 inputs
    with pytest.raises(subprocess.CalledProcessError) as err:
        runner(CMD + ['-o', 'f', '_{}'.format(input_filename)])
    assert err.value.returncode == 1
Esempio n. 60
0
def test_type1mm_inputs(fname, args):
    fname2 = f'.{"".join(args)}' if args else ''
    actual_path = runner(CMD + ['-s', '-f', f'{fname}.pfb', '-o', '2'] + args)
    expected_path = get_expected_path(f'{fname}.dump2{fname2}.txt')
    assert differ([expected_path, actual_path, '-s', '## Filename'])