Message90658
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. |
|
Date |
User |
Action |
Args |
2009-07-18 08:23:44 | jasontiller | set | recipients:
+ jasontiller, georg.brandl |
2009-07-18 08:23:43 | jasontiller | set | messageid: <1247905423.14.0.152000712905.issue6513@psf.upfronthosting.co.za> |
2009-07-18 08:23:41 | jasontiller | link | issue6513 messages |
2009-07-18 08:23:40 | jasontiller | create | |
|