Skip to content
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

BUG: tm.assert_produces_warning() doesn't work with expected_warning=None or False #38620

Closed
3 tasks done
mzeitlin11 opened this issue Dec 21, 2020 · 2 comments · Fixed by #38626
Closed
3 tasks done
Assignees
Labels
Bug Regression Functionality that used to work in a prior pandas version Testing pandas testing functions or related to the test suite
Milestone

Comments

@mzeitlin11
Copy link
Member

mzeitlin11 commented Dec 21, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import warnings
import pandas._testing as tm

with tm.assert_produces_warning(None):
    warnings.warn(UserWarning)

with tm.assert_produces_warning(False):
    warnings.warn(RuntimeWarning)

Problem description

Docs for this function say "To check that no warning is returned, specify False or None". It also includes the second example as something that should raise an AssertionError. However, both these examples do not raise.

Expected Output

Raise AssertionError for both.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 9a46a4b
python : 3.8.6.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8

pandas : 1.3.0.dev0+125.g9a46a4b70
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 20.3.1
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.2.0
hypothesis : 5.43.3
sphinx : 3.3.1
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.4
fastparquet : 0.4.1
gcsfs : 0.7.1
matplotlib : 3.3.3
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.4.2
scipy : 1.5.3
sqlalchemy : 1.3.20
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.2
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.52.0

@mzeitlin11 mzeitlin11 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 21, 2020
@mzeitlin11
Copy link
Member Author

take

@simonjayhawkins
Copy link
Member

first bad commit: [77811c7] ENH: implement matching warning message (#37263)

@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Dec 22, 2020
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Dec 22, 2020
@jreback jreback modified the milestones: Contributions Welcome, 1.3 Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression Functionality that used to work in a prior pandas version Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants