ran tests

This commit is contained in:
ShiroYasha18 2025-05-27 21:18:27 +05:30
parent abcbde71b6
commit e36a4200da

View File

@ -80,7 +80,7 @@ def test_pages(documents) -> None:
"""
# number of pages from the backend method
# Logic to handle multiple files
file_stems = ["sample_sales_data"]
file_stems = ["sample_sales_data","test-01"]
for stem in file_stems:
path = next(item for item in get_excel_paths() if item.stem == stem)
in_doc = InputDocument(
@ -91,18 +91,18 @@ def test_pages(documents) -> None:
)
backend = MsExcelDocumentBackend(in_doc=in_doc, path_or_stream=path)
# Update the expected page count based on actual content
expected_page_count = 1 # Adjust this value based on the actual number of worksheets this needs to be adjusted for each xlsm and xlsx files independently
expected_page_count = 3 # Adjust this value based on the actual number of worksheets this needs to be adjusted for each xlsm and xlsx files independently
assert backend.page_count() == expected_page_count
# number of pages from the converted document
doc = next(item for path, item in documents if path.stem == stem)
assert len(doc.pages) == 1
assert len(doc.pages) == 3
# page sizes as number of cells
# for xlsm file just adjust this wrt the xlsm files for test xlsm enable this:
assert doc.pages.get(1).size.as_tuple() == (4.0, 21.0)
#assert doc.pages.get(1).size.as_tuple() == (4.0, 21.0)
# for xlsx file:
#assert doc.pages.get(1).size.as_tuple() == (3.0, 7.0)
#assert doc.pages.get(2).size.as_tuple() == (9.0, 18.0)
#assert doc.pages.get(3).size.as_tuple() == (13.0, 36.0)
assert doc.pages.get(1).size.as_tuple() == (3.0, 7.0)
assert doc.pages.get(2).size.as_tuple() == (9.0, 18.0)
assert doc.pages.get(3).size.as_tuple() == (13.0, 36.0)