-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
TST: Test coverage for Excel Formatter.py #61741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
breaking_row_count = 2**20 + 1 | ||
breaking_col_count = 2**14 + 1 | ||
|
||
# Test for too many rows | ||
row_df = DataFrame(np.zeros(shape=(breaking_row_count, 1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This there a way to test this without actually allocating such a large array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, I'd prefer not to include this test this case due to the large memory allocation
df = DataFrame({"A": [1, 2], "B": [3, 4]}) | ||
msg = "Not all names specified in 'columns' are found" | ||
with pytest.raises(KeyError, match=msg): | ||
ExcelFormatter(df, cols=columns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, could you write tests that exercise to_excel
instead of ExcelFormatter
and its private methods instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense.
✅ Tests added and passed if fixing a bug or adding a new feature
✅ All code checks passed.
Added tests to the ExcelFormatter class, which gets the file up to 93% test coverage in total. The only exception is the
.write
function, (otherwise writing to excel in the first place is not tested) but is already most definitely covered, but should be tested further.Leo