def test_pipeline_many_valid_inputs_clean(self): """A Pipeline with multiple, properly indexed inputs is clean.""" p = Pipeline(family=PipelineFamily()) self.add_inputs(p, TransformationInput(dataset_idx=2), TransformationInput(dataset_idx=1), TransformationInput(dataset_idx=3)) p.clean()
def test_pipeline_no_inputs_no_steps(self): """A Pipeline with no inputs and no steps is clean but not complete.""" p = Pipeline(family=PipelineFamily()) p.clean() self.assertRaisesRegexp( ValidationError, re.escape("Pipeline {} has no steps".format(p)), p.complete_clean)
def test_pipeline_one_valid_input_no_steps(self): """A Pipeline with one valid input, but no steps, is clean but not complete.""" p = Pipeline(family=PipelineFamily()) self.add_inputs(p, TransformationInput(dataset_idx=1)) p.clean() self.assertRaisesRegexp( ValidationError, re.escape("Pipeline {} has no steps".format(p)), p.complete_clean)
def test_pipeline_many_valid_steps_clean(self): """Test step index check, well-indexed multi-step case.""" p = Pipeline(family=PipelineFamily()) self.add_inputs(p, TransformationInput(dataset_idx=1)) m = Method() self.add_inputs(m, TransformationInput(dataset_idx=1)) p.steps.add(PipelineStep(pipeline=p, transformation=m, step_num=2)) p.steps.add(PipelineStep(pipeline=p, transformation=m, step_num=1)) p.steps.add(PipelineStep(pipeline=p, transformation=m, step_num=3)) p.clean()