Skip to content

Commit

Permalink
Merge pull request #4 from kishorek/develop
Browse files Browse the repository at this point in the history
Fixed comparing empty cells
  • Loading branch information
kishorek authored Jul 2, 2020
2 parents e9dc523 + db8cef1 commit 7f41154
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion comparesv.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def fetch_compare_mode(data_type, string_match):


def compare_cells(cell1, cell2, comparison_type, ignore_case):
if not cell1 or not cell2:
if not cell1 and not cell2:
return True
elif not cell1 or not cell2:
return False

try:
Expand Down
11 changes: 11 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ def test_basic():
assert result == output['results']
assert values == output['values']

def test_basic_empty():
h1 = ["id", "age"]
h2 = ["id", "age"]
d1 = [["A1", 23], ["A2", 24], ["", 34]]
d2 = [["A1", 23], ["A2", 24], ["", 34]]

result = [[True, True], [True, True], [True, True]]
values = [['[A1]:[A1]', '[23]:[23]'], ['[A2]:[A2]', '[24]:[24]'], ['[]:[]', '[34]:[34]']]
output = comparesv.run(d1, h1, d2, h2)
assert result == output['results']
assert values == output['values']

def test_column_order():
h1 = ["id", "age"]
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = 0.13
__version__ = 0.14

0 comments on commit 7f41154

Please sign in to comment.