Skip to content

Commit

Permalink
fixup! fixup! update find_table to return correct behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
lavigne958 committed Sep 8, 2024
1 parent e9fe389 commit 5b41d73
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ def test_find_table_simple(self):
"B2",
utils.TableDirection.table,
)

table_max_row_max_column = utils.find_table(
values,
"D3",
utils.TableDirection.table,
)
right = utils.find_table(
values,
"B2",
Expand All @@ -535,9 +541,18 @@ def test_find_table_simple(self):
["B2", "C2"],
["B3", "C3"],
]

for rowindex, row in enumerate(table_values):
self.assertListEqual(row, table[rowindex])

table_max_row_max_column_values = [
["D3", "E3"],
["D4", "E4"],
]

for rowindex, row in enumerate(table_max_row_max_column):
self.assertListEqual(row, table_max_row_max_column_values[rowindex])

right_values = [
["B2", "C2"],
]
Expand Down Expand Up @@ -645,3 +660,16 @@ def test_find_table_last_column_gap(self):

for rowindex, row in enumerate(expected_table):
self.assertListEqual(row, table[rowindex])

def test_find_table_empty_top_left_corner(self):
"""Test find table with an empty top left cell and empty adjacent cells"""

values = [
["", "", "C1", ""],
["", "B2", "C2", ""],
["", "B3", "C3", ""],
]

table = utils.find_table(values, "A1", utils.TableDirection.table)

self.assertListEqual(table, [], "resulting table should be empty")

0 comments on commit 5b41d73

Please sign in to comment.