def test_handle_logsExclusions(self): #pylint: disable=no-member read = MockRead() mate_transform = MicroMock(filters=()) mock_log = MockLog() handler = ExcludeNonMatchedReadHandler(log_method=mock_log.log) try: handler.handle(read, MicroMock(filters=("filterA")), mate_transform) except StopIteration: pass try: handler.handle(read, MicroMock(filters=("filterA")), mate_transform) except StopIteration: pass try: handler.handle(read, MicroMock(filters=("filterB")), mate_transform) except StopIteration: pass self.assertEquals(2, len(handler._all_exclusions)) self.assertEquals(2, handler._all_exclusions["filterA"]) self.assertEquals(1, handler._all_exclusions["filterB"]) handler.end() self.assertEquals(2, len(mock_log._log_calls))
def test_handle_noExceptionIfNoFilters(self): read = MockRead() transformation = MicroMock(filters=()) mate_transformation = MicroMock(filters=()) mock_log = MockLog() handler = ExcludeNonMatchedReadHandler(log_method=mock_log.log) handler.handle(read, transformation, mate_transformation) self.assertEquals(True, True)
def test_handle_raisesIfTransformHasFilter(self): #pylint: disable=no-member read = MockRead() transformation = MicroMock(filters=("filterA")) mate_transformation = MicroMock(filters=()) mock_log = MockLog() handler = ExcludeNonMatchedReadHandler(log_method=mock_log.log) self.assertRaises(StopIteration, handler.handle, read, transformation, mate_transformation)