self.assertKevent(kevent, fd, select.KQ_FILTER_READ, select.KQ_EV_ADD) def assertWriteEventAdded(self, kevent, fd): self.assertKevent(kevent, fd, select.KQ_FILTER_WRITE, select.KQ_EV_ADD) def assertDeletedEvent(self, kevent, fd): self.assertKevent(kevent, fd, select.KQ_FILTER_READ | select.KQ_FILTER_WRITE, select.KQ_EV_DELETE) def assertKevent(self, kevent, ident, filter, flags): self.assertEqual(kevent.ident, ident) self.assertEqual(kevent.filter, filter) self.assertEqual(kevent.flags, flags) if implements_poll(): PollerPollTestsBase = unittest.TestCase else: PollerPollTestsBase = SkipTestCase class PollerPollTests(PollerPollTestsBase): def _makeOne(self, options): return PollPoller(options) def test_register_readable(self): select_poll = DummySelectPoll() poller = self._makeOne(DummyOptions()) poller._poller = select_poll poller.register_readable(6)
def assertReadEventDeleted(self, kevent, fd): self.assertKevent(kevent, fd, select.KQ_FILTER_READ, select.KQ_EV_DELETE) def assertWriteEventDeleted(self, kevent, fd): self.assertKevent(kevent, fd, select.KQ_FILTER_WRITE, select.KQ_EV_DELETE) def assertKevent(self, kevent, ident, filter, flags): self.assertEqual(kevent.ident, ident) self.assertEqual(kevent.filter, filter) self.assertEqual(kevent.flags, flags) if implements_poll(): PollerPollTestsBase = unittest.TestCase else: PollerPollTestsBase = SkipTestCase class PollerPollTests(PollerPollTestsBase): def _makeOne(self, options): return PollPoller(options) def test_register_readable(self): select_poll = DummySelectPoll() poller = self._makeOne(DummyOptions()) poller._poller = select_poll poller.register_readable(6) poller.register_readable(7)