[issue6513] Standard Library, Warnings, 28.5.4, example fails
Jason Tiller
report at bugs.python.org
Sat Jul 18 10:23:43 CEST 2009
New submission from Jason Tiller <jason at sonos.org>:
The example provided in section 28.5.4 (warnings) of the Standard
Library documentation fails. This example assumes that the context
manager instance ('w' in "warnings.catch_warnings(record=True) as w")
supplies a list of objects, each of which has a data attribute
'.category' that is an instance. However, the '.category' data
attribute is actually a class.
The example code fails in this way on 2.6.2:
-----
Traceback (most recent call last):
File "bob.py", line 14, in <module>
assert isinstance(w[-1].category, DeprecationWarning)
AssertionError
-----
Replacing 'isinstance' with 'issubclass' appears to satisfy the assertion.
----------
assignee: georg.brandl
components: Documentation
messages: 90658
nosy: georg.brandl, jasontiller
severity: normal
status: open
title: Standard Library, Warnings, 28.5.4, example fails
versions: Python 2.6, Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6513>
_______________________________________
More information about the Python-bugs-list
mailing list