Пример #1
0
    def test_rename_keeps_saving_order(self):
        pipeline = CompVizPipeline()

        pipeline.add_operator('op1', TestOperator())
        pipeline.add_operator('op2', TestOperator())
        pipeline.add_operator('op3', TestOperator())

        pipeline.rename_operator('op2', 'renamed')

        stream = StringIO()
        pipeline.save(stream)
        stream.seek(0)
        config = yaml.safe_load(stream)

        operators_order = [
            op_config['name'] for op_config in config['pipeline']
        ]
        assert operators_order == ['op1', 'renamed', 'op3']
Пример #2
0
 def test_pipeline_save_writes(self):
     pipeline = CompVizPipeline()
     output_stream = Mock()
     output_stream.write = Mock()
     pipeline.save(output_stream)
     output_stream.write.assert_called()
Пример #3
0
 def test_pipeline_save_runs(self):
     pipeline = CompVizPipeline()
     pipeline.save(StringIO())