def test_load_error_if_task_has_metaproduct_and_no_key(): dag = DAG() task = PythonCallable(touch_meta, {'a': File('a'), 'b': File('b')}, dag) with pytest.raises(ValueError): task.load()
def test_load_from_metaproduct(tmp_directory): Path('a.csv').write_text('a,b\n1,2') dag = DAG() task = PythonCallable(touch_meta, { 'a': File('a.csv'), 'b': File('b') }, dag) assert task.load(key='a') is not None
def test_pythoncallable(tmp_directory, product, kwargs): df = pd.DataFrame({'a': [1, 2, 3]}) df.to_csv('my_file.csv', index=False) def callable_(product): pass task = PythonCallable(callable_, product, DAG(), name='task') loaded = task.load(**kwargs) assert df.equals(loaded)