def test_bad_module(self): fake_module_name = "NonExistingFilter12" in_ops = [ImageOperation(fake_module_name, [], {}, "unknown")] ops = operations.ops_to_partials(in_ops) with self.assertRaisesRegex(KeyError, MODULE_NOT_FOUND.format(fake_module_name)): list(ops)
def apply_ops(self, ops: Iterable[ImageOperation], copy: bool): if copy: self.images = self.images.copy() to_apply = ops_to_partials(ops) for op in to_apply: op(self.images) return self.images
def test_finds_modules(self): in_ops = [ ImageOperation("RebinFilter", [], {}, "Rebin"), ImageOperation("MedianFilter", [], {}, "Median") ] ops = operations.ops_to_partials(in_ops) # expand the generator to see all functions ops = list(ops) self.assertEqual(len(ops), len(in_ops))