py.user added the comment:
What second line?
the second line patched in the diff file
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18573
___
py.user added the comment:
What about the second line?
It doesn't catch any exception
utest.py
#!/usr/bin/env python3
import unittest
class Test(unittest.TestCase):
def test_warning(self):
import warnings
with self.assertWarns(RuntimeWarning) as cm:
raise
Terry J. Reedy added the comment:
What about the second line?
What second line?
It doesn't catch any exception
It? I do not understand your point. Your example works as documented, including
any unexpected exception is an error.
Actually, that should be 'any exception' as none is expected.
Roundup Robot added the comment:
New changeset 366beee880aa by Terry Jan Reedy in branch '3.3':
Issue #18573: More copy-paste fixes to assertWarns entry.
http://hg.python.org/cpython/rev/366beee880aa
--
___
Python tracker rep...@bugs.python.org
New submission from py.user:
http://docs.python.org/3/library/unittest.html#unittest.TestCase.assertWarns
When used as a context manager, assertRaises() accepts
... is to perform additional checks on the exception raised
--
assignee: docs@python
components: Documentation
files:
Changes by Terry J. Reedy tjre...@udel.edu:
--
stage: - needs patch
versions: +Python 2.7, Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18573
___
Changes by Terry J. Reedy tjre...@udel.edu:
--
assignee: docs@python - terry.reedy
nosy: +terry.reedy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18573
___
Roundup Robot added the comment:
New changeset 55dcf9e065be by Terry Jan Reedy in branch '3.3':
Issue #18573: Complete copy-paste from assertRaises entry to assertWarns entry.
http://hg.python.org/cpython/rev/55dcf9e065be
--
nosy: +python-dev
___
Terry J. Reedy added the comment:
assertWarns is new in 3.2 and not in 2.7.
The sentence was copied from the assertRaises section but not changed.
Thanks for reporting.
--
resolution: - fixed
stage: needs patch - committed/rejected
status: open - closed
type: enhancement - behavior