Skip to content

Two tests didn't properly assert an exception was raised. Fixed. #21409

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

Merged
merged 6 commits into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,5 @@ Other
^^^^^

- :meth: `~pandas.io.formats.style.Styler.background_gradient` now takes a ``text_color_threshold`` parameter to automatically lighten the text color based on the luminance of the background color. This improves readability with dark background colors without the need to limit the background colormap range. (:issue:`21258`)
-
-
- fixed two test cases which asserted an exception message but failed to make sure that an exception was actually raised
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary for test changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, reverted.

-
5 changes: 2 additions & 3 deletions pandas/tests/indexes/datetimes/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ def test_get_indexer(self):
def test_reasonable_keyerror(self):
# GH#1062
index = DatetimeIndex(['1/3/2000'])
try:
with pytest.raises(KeyError) as excinfo:
index.get_loc('1/1/2000')
except KeyError as e:
assert '2000' in str(e)
assert '2000' in str(excinfo.value)
5 changes: 2 additions & 3 deletions pandas/tests/io/parser/c_parser_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ def test_buffer_overflow(self):
cperr = 'Buffer overflow caught - possible malformed input file.'

for malf in (malfw, malfs, malfl):
try:
with pytest.raises(pd.errors.ParserError) as excinfo:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u parametrize this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parametrized in f47437e.

self.read_table(StringIO(malf))
except Exception as err:
assert cperr in str(err)
assert cperr in str(excinfo.value)

def test_buffer_rd_bytes(self):
# see gh-12098: src->buffer in the C parser can be freed twice leading
Expand Down