def test_set_missing_parameters_raise_error() -> None: backend = DummyBackendEntrypointKwargs() with pytest.raises(TypeError): plugins.set_missing_parameters({"engine": backend}) backend_args = DummyBackendEntrypointArgs() with pytest.raises(TypeError): plugins.set_missing_parameters({"engine": backend_args})
def test_set_missing_parameters(): backend_1 = plugins.BackendEntrypoint(dummy_open_dataset) backend_2 = plugins.BackendEntrypoint(dummy_open_dataset, ("filename_or_obj", )) engines = {"engine_1": backend_1, "engine_2": backend_2} plugins.set_missing_parameters(engines) assert len(engines) == 2 engine_1 = engines["engine_1"] assert engine_1.open_dataset_parameters == ("filename_or_obj", "decoder") engine_2 = engines["engine_2"] assert engine_2.open_dataset_parameters == ("filename_or_obj", )
def test_set_missing_parameters_raise_error(): backend = plugins.BackendEntrypoint(dummy_open_dataset_args) with pytest.raises(TypeError): plugins.set_missing_parameters({"engine": backend}) backend = plugins.BackendEntrypoint(dummy_open_dataset_args, ("filename_or_obj", "decoder")) plugins.set_missing_parameters({"engine": backend}) backend = plugins.BackendEntrypoint(dummy_open_dataset_kwargs) with pytest.raises(TypeError): plugins.set_missing_parameters({"engine": backend}) backend = plugins.BackendEntrypoint(dummy_open_dataset_kwargs, ("filename_or_obj", "decoder")) plugins.set_missing_parameters({"engine": backend})
def test_set_missing_parameters() -> None: backend_1 = DummyBackendEntrypoint1 backend_2 = DummyBackendEntrypoint2 backend_2.open_dataset_parameters = ("filename_or_obj",) engines = {"engine_1": backend_1, "engine_2": backend_2} plugins.set_missing_parameters(engines) assert len(engines) == 2 assert backend_1.open_dataset_parameters == ("filename_or_obj", "decoder") assert backend_2.open_dataset_parameters == ("filename_or_obj",) backend = DummyBackendEntrypointKwargs() backend.open_dataset_parameters = ("filename_or_obj", "decoder") plugins.set_missing_parameters({"engine": backend}) assert backend.open_dataset_parameters == ("filename_or_obj", "decoder") backend_args = DummyBackendEntrypointArgs() backend_args.open_dataset_parameters = ("filename_or_obj", "decoder") plugins.set_missing_parameters({"engine": backend_args}) assert backend_args.open_dataset_parameters == ("filename_or_obj", "decoder")