Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_label_files(self):
"""Tests input/output file labelling."""
wd = Path('/fakeworkingdir')
self.assertEqual(
compile_inputs_outputs(
[{'argv': ['aa', 'bb.txt'], 'workingdir': wd}],
[[wd / 'aa', Path('/other/cc.bin'), wd / 'bb.txt']],
[[]]),
{'arg0': InputOutputFile(wd / 'aa', [0], []),
'cc.bin': InputOutputFile(Path('/other/cc.bin'), [0], []),
'arg1': InputOutputFile(wd / 'bb.txt', [0], [])})
def test_label_files(self):
"""Tests input/output file labelling."""
wd = Path('/fakeworkingdir')
self.assertEqual(
compile_inputs_outputs(
[{'argv': ['aa', 'bb.txt'], 'workingdir': wd}],
[[wd / 'aa', Path('/other/cc.bin'), wd / 'bb.txt']],
[[]]),
{'arg0': InputOutputFile(wd / 'aa', [0], []),
'cc.bin': InputOutputFile(Path('/other/cc.bin'), [0], []),
'arg1': InputOutputFile(wd / 'bb.txt', [0], [])})
run_nb, arg_nb = runs_with_file[fi]
parts = []
# Run number, if there are more than one runs
if len(runs) > 1:
parts.append(run_nb)
# Argument number, if there are more than one file arguments
if nb_file_args[run_nb] > 1:
parts.append(arg_nb)
file_names[fi] = make_unique(
'arg%s' % '_'.join('%s' % s for s in parts))
else:
file_names[fi] = make_unique('arg_%s' % fi.unicodename)
else:
file_names[fi] = make_unique(fi.unicodename)
return dict((n, InputOutputFile(p, readers.get(p, []), writers.get(p, [])))
for p, n in iteritems(file_names))
run_nb, arg_nb = runs_with_file[fi]
parts = []
# Run number, if there are more than one runs
if len(runs) > 1:
parts.append(run_nb)
# Argument number, if there are more than one file arguments
if nb_file_args[run_nb] > 1:
parts.append(arg_nb)
file_names[fi] = make_unique(
'arg%s' % '_'.join('%s' % s for s in parts))
else:
file_names[fi] = make_unique('arg_%s' % fi.unicodename)
else:
file_names[fi] = make_unique(fi.unicodename)
return dict((n, InputOutputFile(p, readers.get(p, []), writers.get(p, [])))
for p, n in iteritems(file_names))