Skip to content

Commit 3985503

Browse files
committed
Update end to end tests to work for current master
1 parent f4290b1 commit 3985503

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

flattentool/tests/test_end_to_end.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@
4545
from jsonref import JsonRef
4646
import pytest
4747

48-
from flattentool.input import SpreadsheetInput, convert_type, WITH_CELLS
48+
from flattentool.input import SpreadsheetInput, convert_type
4949
from flattentool.tests.test_init import original_cell_and_row_locations, original_headings
5050
from flattentool.schema import SchemaParser
51+
from flattentool.exceptions import DataErrorWarning
5152

5253

5354
def test_type_conversion_no_schema():
@@ -138,7 +139,7 @@ def test_type_conversion_with_schema():
138139
('decimal', 'InvalidDecimal'),
139140
('float', 'InvalidFloat')]),
140141
]
141-
with pytest.warns(UserWarning) as type_warnings:
142+
with pytest.warns(DataErrorWarning) as type_warnings:
142143
assert (expected, None, None) == run(sheets, schema)
143144
# check that only one warning was raised
144145
assert len(type_warnings) == 3
@@ -334,9 +335,8 @@ def test_merging_cols():
334335
def test_dict(sheets, schema, expected_result, expected_cell_source_map, expected_heading_source_map):
335336
result, cell_source_map, heading_source_map = run(sheets, schema=schema, source_maps=True)
336337
assert expected_result == result
337-
if WITH_CELLS:
338-
assert expected_cell_source_map == cell_source_map
339-
assert expected_heading_source_map == heading_source_map
338+
assert expected_cell_source_map == cell_source_map
339+
assert expected_heading_source_map == heading_source_map
340340

341341

342342
test_list_of_dicts_data_result = [
@@ -486,9 +486,8 @@ def test_dict(sheets, schema, expected_result, expected_cell_source_map, expecte
486486
def test_list_of_dicts(sheets, schema, expected_result, expected_cell_source_map, expected_heading_source_map):
487487
result, cell_source_map, heading_source_map = run(sheets, schema=schema, source_maps=True)
488488
assert expected_result == result
489-
if WITH_CELLS:
490-
assert expected_cell_source_map == cell_source_map
491-
assert expected_heading_source_map == heading_source_map
489+
assert expected_cell_source_map == cell_source_map
490+
assert expected_heading_source_map == heading_source_map
492491

493492

494493
test_list_of_dicts_with_ids_data_result = [
@@ -666,9 +665,8 @@ def test_list_of_dicts(sheets, schema, expected_result, expected_cell_source_map
666665
def test_list_of_dicts_with_ids(sheets, schema, expected_result, expected_cell_source_map, expected_heading_source_map):
667666
result, cell_source_map, heading_source_map = run(sheets, schema=schema, source_maps=True)
668667
assert expected_result == result
669-
if WITH_CELLS:
670-
assert expected_cell_source_map == cell_source_map
671-
assert expected_heading_source_map == heading_source_map
668+
assert expected_cell_source_map == cell_source_map
669+
assert expected_heading_source_map == heading_source_map
672670

673671

674672
test_arrangement_data_sheets = (
@@ -957,11 +955,10 @@ def test_arrangement(
957955
actual_original_cell_and_row_locations = original_cell_and_row_locations(actual_cell_source_map or {})
958956
actual_original_heading_locations = original_headings(actual_heading_source_map or {})
959957
assert expected_result == actual_result
960-
if WITH_CELLS:
961-
assert expected_cell_source_map == actual_cell_source_map
962-
assert expected_heading_source_map == actual_heading_source_map
963-
assert expected_original_cell_and_row_locations == actual_original_cell_and_row_locations
964-
assert expected_original_heading_locations == actual_original_heading_locations
958+
assert expected_cell_source_map == actual_cell_source_map
959+
assert expected_heading_source_map == actual_heading_source_map
960+
assert expected_original_cell_and_row_locations == actual_original_cell_and_row_locations
961+
assert expected_original_heading_locations == actual_original_heading_locations
965962

966963

967964
class HeadingListInput(SpreadsheetInput):
@@ -981,8 +978,6 @@ def read_sheets(self):
981978

982979

983980
def run(sheets, schema=None, source_maps=False):
984-
if not WITH_CELLS:
985-
source_maps = False
986981
input_headings = OrderedDict()
987982
input_sheets = OrderedDict()
988983
for sheet in sheets:

0 commit comments

Comments
 (0)