|
1
|
|
|
import pytest |
|
2
|
|
|
|
|
3
|
|
|
from tests.conftest import EmptyPlugin, get_test_data_path |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
@pytest.mark.parametrize('path', [ |
|
7
|
|
|
'column_based_position_mix_1.xlsx', |
|
8
|
|
|
'column_based_position_mix_2.xlsx', |
|
9
|
|
|
'column_based_position_mix_3.xlsx', |
|
10
|
|
|
'column_based_position_mix_4.xlsx', |
|
11
|
|
|
]) |
|
12
|
|
|
def test_matrix_column_based_positive(empty_app, path): |
|
13
|
|
|
plugin = EmptyPlugin(empty_app) |
|
14
|
|
|
workbook_path = get_test_data_path(path) |
|
15
|
|
|
config_path = get_test_data_path('config_column_based_position_mix.json') |
|
16
|
|
|
data = plugin.excel_validation.read_excel(config_path, workbook_path) |
|
17
|
|
|
assert len(data) == 3 |
|
18
|
|
|
assert data[2]['Text'] == 'Text 1' |
|
19
|
|
|
assert data[2]['Integer'] == -2 |
|
20
|
|
|
assert data[4]['Text'] == 'Text 3' |
|
21
|
|
|
assert data[4]['Integer'] == 30 |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
@pytest.mark.parametrize('config_json', [ |
|
25
|
|
|
'config_column_based_errors_1.json', |
|
26
|
|
|
'config_column_based_errors_2.json', |
|
27
|
|
|
'config_column_based_errors_3.json', |
|
28
|
|
|
'config_column_based_errors_4.json' |
|
29
|
|
|
]) |
|
30
|
|
|
def test_matrix_column_based_errors(empty_app, config_json): |
|
31
|
|
|
plugin = EmptyPlugin(empty_app) |
|
32
|
|
|
workbook_path = get_test_data_path('column_based.xlsx') |
|
33
|
|
|
config_path = get_test_data_path(config_json) |
|
34
|
|
|
with pytest.raises(ValueError): |
|
35
|
|
|
plugin.excel_validation.read_excel(config_path, workbook_path) |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
@pytest.mark.parametrize('path', [ |
|
39
|
|
|
'row_based_position_mix_1.xlsx', |
|
40
|
|
|
'row_based_position_mix_2.xlsx', |
|
41
|
|
|
'row_based_position_mix_3.xlsx', |
|
42
|
|
|
'row_based_position_mix_4.xlsx', |
|
43
|
|
|
]) |
|
44
|
|
|
def test_matrix_row_based_positive(empty_app, path): |
|
45
|
|
|
plugin = EmptyPlugin(empty_app) |
|
46
|
|
|
workbook_path = get_test_data_path(path) |
|
47
|
|
|
config_path = get_test_data_path('config_row_based_position_mix.json') |
|
48
|
|
|
data = plugin.excel_validation.read_excel(config_path, workbook_path) |
|
49
|
|
|
assert len(data) == 3 |
|
50
|
|
|
assert data[2]['Text'] == 'Text 1' |
|
51
|
|
|
assert data[2]['Integer'] == -2 |
|
52
|
|
|
assert data[4]['Text'] == 'Text 3' |
|
53
|
|
|
assert data[4]['Integer'] == 30 |
|
54
|
|
|
|