def test_simple_chain(self): '''Check that a chain with printout filters works.''' chain = FilterChain( [IncrementFilter(1), IncrementFilter(2), IncrementFilter(3)]) request = Struct(x=0) self.assertFalse(chain.handle(request)) assert_equal(request.x, 6, 'Bad chain processing')
def setUp(self): '''Load test data and expected results.''' unittest.TestCase.setUp(self) # Load test data ready from previous phasing stagees self.problem = io.read_npz(itu.FAMILY13_STAGE2) self.family = self.problem.families()[0] self.phaser = phase_core.PhaseDecorator( FilterChain([ trivial_phaser(), family_phaser(), family_child_comparison_phaser() ])) self.comparator = ic.ChildComparator( Struct(problem=self.problem, params=PhaseParam()), self.family)