mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Merged revisions 80875 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80875 | giampaolo.rodola | 2010-05-06 19:57:06 +0200 (gio, 06 mag 2010) | 1 line Fix asyncore issues 8573 and 8483: _strerror might throw ValueError; asyncore.__getattr__ cheap inheritance caused confusing error messages when accessing undefined class attributes; added an alias for __str__ which now is used as a fallback for __repr__ ........
This commit is contained in:
parent
d75b2a90d9
commit
8d2dc85154
3 changed files with 43 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ import os
|
|||
import socket
|
||||
import sys
|
||||
import time
|
||||
import warnings
|
||||
|
||||
from test import support
|
||||
from test.support import TESTFN, run_unittest, unlink
|
||||
|
|
@ -306,6 +307,22 @@ class DispatcherTests(unittest.TestCase):
|
|||
'warning: unhandled accept event']
|
||||
self.assertEquals(lines, expected)
|
||||
|
||||
def test_issue_8594(self):
|
||||
# XXX - this test is supposed to be removed in next major Python
|
||||
# version
|
||||
d = asyncore.dispatcher(socket.socket())
|
||||
# make sure the error message no longer refers to the socket
|
||||
# object but the dispatcher instance instead
|
||||
self.assertRaisesRegexp(AttributeError, 'dispatcher instance',
|
||||
getattr, d, 'foo')
|
||||
# cheap inheritance with the underlying socket is supposed
|
||||
# to still work but a DeprecationWarning is expected
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
family = d.family
|
||||
self.assertEqual(family, socket.AF_INET)
|
||||
self.assertTrue(len(w) == 1)
|
||||
self.assertTrue(issubclass(w[0].category, DeprecationWarning))
|
||||
|
||||
|
||||
class dispatcherwithsend_noread(asyncore.dispatcher_with_send):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue