def test_pipeline_runner_build_datasets(sample_ids, tiny_files_structure):
    runner = PipelineRunner(file_structure=tiny_files_structure, )
    X_train, y_train, X_val, y_val = runner.build_datasets(
        BenchmarkDataset(), sample_ids[:-2], sample_ids[-2:])

    assert X_train.any()
    assert X_val.any()
    assert y_train.any()
    assert y_val.any()
def test_pipeline_runner_run_calls(tiny_files_structure, sample_ids):
    runner = PipelineRunner(file_structure=tiny_files_structure, )
    runner.ds_builder = Mock(spec=DatasetBuilder)
    runner.model_trainer = Mock(spec=ModelTrainer)

    runner.get_model_path = Mock(spec=runner.get_model_path)
    runner.build_datasets = Mock(spec=runner.build_datasets,
                                 return_value=(0, 0, 0, 0))
    runner.splitter.split = Mock(spec=runner.splitter.split,
                                 return_value=(0, 0))
    runner.evaluate_validation_set = Mock(spec=runner.evaluate_validation_set)
    runner.run_pipeline(
        sample_ids,
        dataset=BenchmarkDataset(),
        model=BenchmarkModel(),
    )

    runner.splitter.split.assert_called_once_with(sample_ids, 0.2)
    runner.build_datasets.assert_called_once()
    runner.get_model_path.assert_called_once()
    runner.model_trainer.train_model.assert_called_once()
    runner.evaluate_validation_set.assert_called_once()