|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | # -*- coding: utf-8 -*-
|
3 | 3 |
|
| 4 | +import os |
4 | 5 | import sys
|
5 | 6 | import pytest
|
6 | 7 |
|
|
12 | 13 | test_filepath_four = "~/dir1/dir2/test.ttf"
|
13 | 14 | percent_value = "10"
|
14 | 15 |
|
| 16 | +expected_linegap_basename = "test-linegap" + percent_value + ".ttf" |
| 17 | + |
| 18 | +expected_testpath_list_one = os.path.split(test_filepath_one) |
| 19 | +expected_testpath_list_two = os.path.split(test_filepath_two) |
| 20 | +expected_testpath_list_three = os.path.split(test_filepath_three) |
| 21 | +expected_testpath_list_four = os.path.split(test_filepath_four) |
| 22 | + |
| 23 | +expected_testpath_one = os.path.join(expected_testpath_list_one[0], expected_linegap_basename) |
| 24 | +expected_testpath_two = os.path.join(expected_testpath_list_two[0], expected_linegap_basename) |
| 25 | +expected_testpath_three = os.path.join(expected_testpath_list_three[0], expected_linegap_basename) |
| 26 | +expected_testpath_four = os.path.join(expected_testpath_list_four[0], expected_linegap_basename) |
| 27 | + |
15 | 28 |
|
16 | 29 | def test_linegap_outfile_filepath_basename():
|
17 | 30 | response = get_linegap_percent_filepath(test_filepath_one, percent_value)
|
18 |
| - assert response == "test-linegap10.ttf" |
| 31 | + assert response == expected_testpath_one |
19 | 32 |
|
20 | 33 |
|
21 | 34 | def test_linegap_outfile_filepath_samedir_withdotsyntax():
|
22 | 35 | response = get_linegap_percent_filepath(test_filepath_two, percent_value)
|
23 |
| - assert response == "./test-linegap10.ttf" |
| 36 | + assert response == expected_testpath_two |
24 | 37 |
|
25 | 38 |
|
26 | 39 | def test_linegap_outfile_filepath_differentdir_fromroot():
|
27 | 40 | response = get_linegap_percent_filepath(test_filepath_three, percent_value)
|
28 |
| - assert response == "/dir1/dir2/test-linegap10.ttf" |
| 41 | + assert response == expected_testpath_three |
29 | 42 |
|
30 | 43 |
|
31 | 44 | def test_linegap_outfile_filepath_differentdir_fromuser():
|
32 | 45 | response = get_linegap_percent_filepath(test_filepath_four, percent_value)
|
33 |
| - assert response == "~/dir1/dir2/test-linegap10.ttf" |
| 46 | + assert response == expected_testpath_four |
34 | 47 |
|
0 commit comments