Skip to content

Commit

Permalink
Minor cleanup test_calc_output_path
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiishi committed Jan 7, 2022
1 parent c4f4a1f commit cefe55d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import pathlib

from east_asian_spacing import calc_output_path
Expand All @@ -11,20 +10,20 @@ def call(input_path, output_path, stem_suffix=None):
if output_path:
output_path = pathlib.Path(output_path)
result = calc_output_path(input_path, output_path, stem_suffix)
return str(result)
return result

assert call('c.otf', None) == 'c.otf'
assert call('a/b/c.otf', None) == os.path.join('a', 'b', 'c.otf')
a = pathlib.Path('a')
assert call('c.otf', None) == pathlib.Path('c.otf')
assert call('a/b/c.otf', None) == a / 'b' / 'c.otf'

assert call('c.otf', None, '-chws') == 'c-chws.otf'
assert call('a/b/c.otf', None,
'-chws') == os.path.join('a', 'b', 'c-chws.otf')
assert call('c.otf', None, '-chws') == pathlib.Path('c-chws.otf')
assert call('a/b/c.otf', None, '-chws') == a / 'b' / 'c-chws.otf'

assert call('c.otf', 'build') == os.path.join('build', 'c.otf')
assert call('a/b/c.otf', 'build') == os.path.join('build', 'c.otf')
build = pathlib.Path('build')
assert call('c.otf', 'build') == build / 'c.otf'
assert call('a/b/c.otf', 'build') == build / 'c.otf'

assert call('a/b/c.otf', 'build',
'-xyz') == os.path.join('build', 'c-xyz.otf')
assert call('a/b/c.otf', 'build', '-xyz') == build / 'c-xyz.otf'


def test_calc_output_path_dir(tmp_path: pathlib.Path):
Expand Down

0 comments on commit cefe55d

Please sign in to comment.