-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from craigastill/fix_skip_interval_for_spreads…
…heets_with_empty_rows_before_data Fix skip interval for spreadsheets with empty rows before data
- Loading branch information
Showing
6 changed files
with
119 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,4 @@ rsa-key | |
tags | ||
singer-check-tap-data | ||
state.json | ||
.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+8.55 KB
tap_spreadsheets_anywhere/test/sample_with_bad_blank_line_above_headings.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import logging | ||
import pytest | ||
from openpyxl import Workbook | ||
from tap_spreadsheets_anywhere.excel_handler import generator_wrapper | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def get_worksheet(): | ||
"""Create a basic workbook that can be manipulated for tests. | ||
See: https://openpyxl.readthedocs.io/en/stable/usage.html. | ||
""" | ||
wb = Workbook() | ||
ws = wb.active | ||
tree_data = [ | ||
["Type", "Leaf Color", "Height"], | ||
["Maple", "Red", 549], | ||
["Oak", "Green", 783], | ||
["Pine", "Green", 1204] | ||
] | ||
exp_tree_data = [ | ||
{'type': 'Maple', 'leaf_color': 'Red', 'height': 549}, | ||
{'type': 'Oak', 'leaf_color': 'Green', 'height': 783}, | ||
{'type': 'Pine', 'leaf_color': 'Green', 'height': 1204}, | ||
] | ||
[ws.append(row) for row in tree_data] | ||
return ws, wb, tree_data, exp_tree_data | ||
|
||
|
||
class TestExcelHandlerGeneratorWrapper: | ||
"""Validate the expected state of the `excel_handler.generator_wrapper`.""" | ||
def test_parse_data(self): | ||
worksheet, _, _, exp = get_worksheet() | ||
_generator = generator_wrapper(worksheet) | ||
assert next(_generator) == exp[0] | ||
assert next(_generator) == exp[1] | ||
assert next(_generator) == exp[2] | ||
with pytest.raises(StopIteration): | ||
next(_generator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters