Commit d33f6830 authored by Jahrules's avatar Jahrules
Browse files

updated testcases for recent changes that were missing coverage as per the hepta pipeline

--HG--
branch : 3.1
parent 72955bc846d8
Pipeline #54155 failed with stage
in 21 minutes and 40 seconds
......@@ -44,7 +44,7 @@ class Search:
def __getitem__(self, index):
if not self._searched:
return None
self.find()
# additional validation - the index ==0 or 1 check
# is there in case a user is using __getitem__ directly
......
......@@ -47,6 +47,14 @@ def test_limit_err():
with pytest.raises(ValueError):
Search(ws,"str",True,['badarr'])
def test_getitem():
wb = Workbook()
ws = wb.active
search = Search(ws, "str")
res = search[0]
assert res == None
@pytest.fixture
def datadir():
"""DATADIR as a LocalPath"""
......@@ -172,6 +180,43 @@ def test_case_search(datadir, searchstring, results):
all_coords.append(cell.coordinate)
assert results == all_coords
@pytest.mark.parametrize("searchstring, results",
[
("Test Data 103",
["J94","I95","H96","G97","F98","E99","D100","C101","B102","A103"]
),
("test Data 103",
["J94","I95","H96","G97","F98","E99","D100","C101","B102","A103"]
),
("unique", ["K173"]),
("NotExist", None)
]
)
def test_case_rescan(datadir, searchstring, results):
datadir.chdir()
wb = load_workbook(filename="Sample_Large.xlsx")
ws = wb.active
search = Search(ws,"test",True)
assert search.search_term == "test"
assert search.ignore_case == True
assert search.limit == 0
search.rescan(searchstring)
assert search.search_term == searchstring
res = search.find_all()
if results == None:
assert res == None
else:
all_coords = []
for cell in res:
all_coords.append(cell.coordinate)
assert results == all_coords
@pytest.mark.parametrize("searchstring, results",
[
("Test Data 10",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment