def __init__(self, initializer=None, age=None, **kwargs): if isinstance(initializer, dict): conf = initializer initializer = None else: conf = kwargs conf["match"] = MatchStrToList(kwargs.get("match")) super(Probe, self).__init__(initializer=initializer, age=age, **conf) if self.filters: handler = filters.GetHandler(mode=self.mode) else: handler = filters.GetHandler() self.baseliner = handler(artifact=self.artifact, filters=self.baseline) self.handler = handler(artifact=self.artifact, filters=self.filters) hinter = Hint(conf.get("hint", {}), reformat=False) self.matcher = Matcher(conf["match"], hinter)
def testSerialHandler(self): h = filters.GetHandler("SERIAL") # Without filters. handler = h("Data", filters=[]) self.assertItemsEqual(self.all, handler.Parse(self.all)) # With filters. handler = h("Data", filters=self.GetFilters(self.ok)) expected = [Sample(0, 0)] self.assertItemsEqual(expected, handler.Parse(self.all))
def testParallelHandler(self): h = filters.GetHandler("PARALLEL") # Without filters. handler = h("Data", filters=[]) self.assertItemsEqual(self.all, handler.Parse(self.all)) # With filters. handler = h("Data", filters=self.GetFilters(self.ok)) expected = [Sample(0, 0), Sample(0, 1), Sample(1, 0)] self.assertItemsEqual(expected, handler.Parse(self.all))
def testNoOpHandler(self): h = filters.GetHandler("PASSTHROUGH") handler = h("Data", filters=self.GetFilters(self.ok)) self.assertItemsEqual(self.all, handler.Parse(self.all))