def test_removeAllSkipsInternalReaders(self): """ Any L{IReadDescriptors} in L{PosixReactorBase._internalReaders} are left alone by L{PosixReactorBase._removeAll}. """ reactor = TrivialReactor() extra = object() reactor._internalReaders.add(extra) reactor.addReader(extra) reactor._removeAll(reactor._readers, reactor._writers) self._checkWaker(reactor) self.assertIn(extra, reactor._internalReaders) self.assertIn(extra, reactor._readers)
def test_removeAllReturnsRemovedDescriptors(self): """ L{PosixReactorBase._removeAll} returns a list of removed L{IReadDescriptor} and L{IWriteDescriptor} objects. """ reactor = TrivialReactor() reader = object() writer = object() reactor.addReader(reader) reactor.addWriter(writer) removed = reactor._removeAll(reactor._readers, reactor._writers) self.assertEqual(set(removed), set([reader, writer])) self.assertNotIn(reader, reactor._readers) self.assertNotIn(writer, reactor._writers)