diff options
author | Josiah Carlson <josiah.carlson@gmail.com> | 2008-07-07 05:04:12 (GMT) |
---|---|---|
committer | Josiah Carlson <josiah.carlson@gmail.com> | 2008-07-07 05:04:12 (GMT) |
commit | 9f2f83338f54a769497fd122e86170aa58cf5603 (patch) | |
tree | 525f6de8d461e6fe1d7c2824e1aa08b7e8d2a285 /Lib/test/test_asyncore.py | |
parent | 35bf9bf68cf70ead3f52c95a677cb27505dec9f9 (diff) | |
download | cpython-9f2f83338f54a769497fd122e86170aa58cf5603.zip cpython-9f2f83338f54a769497fd122e86170aa58cf5603.tar.gz cpython-9f2f83338f54a769497fd122e86170aa58cf5603.tar.bz2 |
Fixed bugs 760475, 953599, and 1519. This is a translation of changelist 64768
to the py3k branch.
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r-- | Lib/test/test_asyncore.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 716368b..335bded 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -39,6 +39,7 @@ class exitingdummy: raise asyncore.ExitNow() handle_write_event = handle_read_event + handle_close_event = handle_read_event handle_expt_event = handle_read_event class crashingdummy: @@ -49,6 +50,7 @@ class crashingdummy: raise Exception() handle_write_event = handle_read_event + handle_close_event = handle_read_event handle_expt_event = handle_read_event def handle_error(self): @@ -118,6 +120,7 @@ class HelperFunctionTests(unittest.TestCase): def __init__(self): self.read = False self.write = False + self.closed = False self.expt = False def handle_read_event(self): @@ -126,6 +129,9 @@ class HelperFunctionTests(unittest.TestCase): def handle_write_event(self): self.write = True + def handle_close_event(self): + self.closed = True + def handle_expt_event(self): self.expt = True @@ -168,9 +174,9 @@ class HelperFunctionTests(unittest.TestCase): for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): tobj = testobj() - self.assertEqual(tobj.expt, False) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], False) asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.expt, True) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) # check that ExitNow exceptions in the object handler method # bubbles all the way up through asyncore readwrite calls |