本文整理汇总了Python中test_utils.get_temp_file_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_temp_file_path函数的具体用法?Python get_temp_file_path怎么用?Python get_temp_file_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_temp_file_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_many_hints_string_bug354
def test_many_hints_string_bug354():
# The glyph [email protected] 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])
示例2: test_subroutine_sorting_bug494
def test_subroutine_sorting_bug494():
""" The input file was made with the command:
tx -t1 -g 0-5 \
source-serif-pro/Roman/Instances/Regular/font.ufo bug494.pfa
The bug is that two subroutines in the Windows CFF output are swapped in
index order from the Mac version. This was because of an unstable
'qsort' done on the subroutines in the final stage of selection."""
font_path = get_input_path('bug494.pfa')
cff_path = get_temp_file_path()
dcf_path = get_temp_file_path()
runner(CMD + ['-a', '-o', 'cff', '*S', 'std', '*b',
'-f', font_path, cff_path])
runner(CMD + ['-a', '-o', 'dcf', '-f', cff_path, dcf_path])
expected_path = get_expected_path('bug494.dcf.txt')
assert differ([expected_path, dcf_path])
示例3: test_cff2_extract
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'])
示例4: test_build_options_cs_cl_bug459
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'])
示例5: test_font_with_outdated_hash_bug239
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
示例6: test_recalculate_font_bbox_bug618
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)
示例7: test_report2
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'])
示例8: test_st28_basic_cmap
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'])
示例9: test_componentize
def test_componentize():
ttf_path = _get_test_ttf_path()
save_path = get_temp_file_path()
opts = Object()
setattr(opts, 'font_path', ttf_path)
setattr(opts, 'output_path', save_path)
ufo, ps_names = ttfcomp.get_glyph_names_mapping(_get_test_ufo_path())
ttcomp_obj = ttfcomp.TTComponentizer(ufo, ps_names, opts)
ttcomp_obj.componentize()
# 'get_composites_data' method
comps_data = ttcomp_obj.composites_data
comps_name_list = sorted(comps_data.keys())
comps_comp_list = [comps_data[gname] for gname in comps_name_list]
assert comps_name_list == ['aa', 'aacute', 'adieresis', 'atilde',
'uni01CE']
assert comps_comp_list[1].names == ('a', 'uni0301')
assert comps_comp_list[4].names == ('a', 'uni030C')
assert comps_comp_list[1].positions == ((0, 0), (263.35, 0))
assert comps_comp_list[4].positions == ((0, 0), (263, 0))
# 'assemble_components' method
comps_data = ttfcomp.ComponentsData()
comps_data.names = ('a', 'uni01CE')
comps_data.positions = ((0, 0), (263, 0))
comps_data.same_advwidth = True
comp_one, comp_two = ttcomp_obj.assemble_components(comps_data)
assert comp_one.glyphName == 'a'
assert comp_two.glyphName == 'uni01CE'
assert (comp_one.x, comp_one.y) == (0, 0)
assert (comp_two.x, comp_two.y) == (263, 0)
assert comp_one.flags == 0x204
assert comp_two.flags == 0x4
示例10: test_run_cli_with_output_path
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'])
示例11: test_linux_ci_failure_bug570
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'])
示例12: test_report
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'])
示例13: test_run_with_output_path
def test_run_with_output_path():
ttf_path = _get_test_ttf_path()
save_path = get_temp_file_path()
ttfcomp.main(['-o', save_path, ttf_path])
gtable = TTFont(save_path)['glyf']
composites = [gname for gname in gtable.glyphs if (
gtable[gname].isComposite())]
assert sorted(composites) == ['aa', 'aacute', 'uni01CE']
示例14: test_run_invalid_ufo
def test_run_invalid_ufo():
ttf_path = _get_test_ttf_path()
temp_dir = tempfile.mkdtemp()
save_path = get_temp_file_path(directory=temp_dir)
ufo_path = save_path + '.ufo'
copy2(ttf_path, save_path)
copy2(ttf_path, ufo_path)
assert ttfcomp.main([save_path]) == 1
示例15: test_beztools_hhint_over_limit_bug629
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'])