-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
get rid of the None engine tests and just have a separate test that ensures how that gets bound to a particular engine #26662 (comment) #28749
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,6 @@ def ignore_xlrd_time_clock_warning(): | |
pytest.mark.filterwarnings("ignore:.*html argument"), | ||
], | ||
), | ||
pytest.param( | ||
None, | ||
marks=[ | ||
td.skip_if_no("xlrd"), | ||
pytest.mark.filterwarnings("ignore:.*(tree\\.iter|html argument)"), | ||
], | ||
), | ||
pytest.param("odf", marks=td.skip_if_no("odf")), | ||
] | ||
) | ||
|
@@ -67,6 +60,24 @@ def engine(request): | |
return request.param | ||
|
||
|
||
@pytest.mark.parametrize("kwargs", [dict(), dict(engine=None)]) | ||
def test_default_engine(datapath, monkeypatch, kwargs): | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use docstrings for tests so OK to remove this as well. You can add the issue number as a comment instead |
||
A test for default ExcelFile engine value (which is None) | ||
""" | ||
monkeypatch.chdir(datapath("io", "data")) | ||
expected = "xlrd" | ||
|
||
result = pd.ExcelFile("blank.xls", **kwargs) | ||
assert result.engine == expected | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this test does testing implicitly for the default value of the engine parameter (which is
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I just think that's fragile to always assume that's how this implementation will work - we'd lose coverage and expose ourselves to bugs if this gets refactored There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree with you. I'll try to figure out a way to test |
||
|
||
|
||
def test_bad_engine_raises(): | ||
WillAyd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bad_engine = "foo" | ||
with pytest.raises(ValueError, match="Unknown engine: foo"): | ||
pd.read_excel("", engine=bad_engine) | ||
|
||
|
||
class TestReaders: | ||
@pytest.fixture(autouse=True) | ||
def cd_and_set_engine(self, engine, datapath, monkeypatch, read_ext): | ||
|
@@ -492,11 +503,6 @@ def test_excel_read_buffer(self, read_ext): | |
actual = pd.read_excel(f, "Sheet1", index_col=0) | ||
tm.assert_frame_equal(expected, actual) | ||
|
||
def test_bad_engine_raises(self, read_ext): | ||
bad_engine = "foo" | ||
with pytest.raises(ValueError, match="Unknown engine: foo"): | ||
pd.read_excel("", engine=bad_engine) | ||
|
||
@tm.network | ||
def test_read_from_http_url(self, read_ext): | ||
if read_ext == ".ods": # TODO: remove once on master | ||
|
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.
Nice idea but I think the parametrization here is overkill so OK to remove