|
1 | 1 | from pathlib import Path
|
2 | 2 |
|
| 3 | +import pytest |
| 4 | + |
3 | 5 | from feefifofum.main import format_feature_file
|
4 | 6 | from feefifofum.utils.file_utils import read_file_lines
|
5 | 7 |
|
6 |
| - |
7 | 8 | ROOT_DIR = Path(__file__).resolve().parent
|
8 | 9 |
|
9 | 10 |
|
10 |
| -def test_format_feature_file() -> None: |
11 |
| - """Tests format_feature_file by running all transformations.""" |
12 |
| - file_path_input = ROOT_DIR / 'data' / 'example_input.feature' |
13 |
| - file_path_expected = ROOT_DIR / 'data' / 'example_expected.feature' |
| 11 | +class TestFormatFeatureFile: |
| 12 | + """Tests for format_feature_file().""" |
| 13 | + |
| 14 | + test_data = [ |
| 15 | + ('full_file_input.feature', 'full_file_expected.feature'), |
| 16 | + ('text_only_input.feature', 'text_only_expected.feature'), |
| 17 | + ] |
| 18 | + |
| 19 | + @pytest.mark.parametrize('input_file, expected_file', test_data) |
| 20 | + def test_format_feature_file(self, input_file: str, expected_file: str) -> None: |
| 21 | + """Tests format_feature_file by running all transformations.""" |
| 22 | + file_path_input = ROOT_DIR / 'data' / input_file |
| 23 | + file_path_expected = ROOT_DIR / 'data' / expected_file |
14 | 24 |
|
15 |
| - file_lines_input = read_file_lines(file_path_input) |
16 |
| - formatted_output = format_feature_file(file_lines_input) |
| 25 | + file_lines_input = read_file_lines(file_path_input) |
| 26 | + formatted_output = format_feature_file(file_lines_input) |
17 | 27 |
|
18 |
| - formatted_expected = read_file_lines(file_path_expected) |
| 28 | + formatted_expected = read_file_lines(file_path_expected) |
19 | 29 |
|
20 |
| - assert formatted_output == formatted_expected |
| 30 | + assert formatted_output == formatted_expected |
0 commit comments