From 31ab7e11088fc915033e39fcea41aff561b15eba Mon Sep 17 00:00:00 2001 From: Jochem Smit Date: Tue, 2 Jan 2024 14:43:58 +0100 Subject: [PATCH] test and example --- examples/create_dataset.py | 12 ++++++++++++ tests/test_hdxms_datasets.py | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 examples/create_dataset.py diff --git a/examples/create_dataset.py b/examples/create_dataset.py new file mode 100644 index 0000000..7b198a9 --- /dev/null +++ b/examples/create_dataset.py @@ -0,0 +1,12 @@ +""" +Run this script to copy the template directory to a create a new dataset +""" + +from pathlib import Path +from hdxms_datasets import create_dataset + + +author_name = "Krishnamurthy" +human_readable_tag = "SecB" # optional tag + +data_id = create_dataset(Path().resolve() / "datasets", "smit", "testing") diff --git a/tests/test_hdxms_datasets.py b/tests/test_hdxms_datasets.py index f8fc40f..3512a3d 100644 --- a/tests/test_hdxms_datasets.py +++ b/tests/test_hdxms_datasets.py @@ -76,6 +76,9 @@ def test_create_dataset(tmp_path): assert (dataset_pth / "readme.md").read_text() == f"# {data_id}" + assert (dataset_pth / "hdx_spec.yaml").exists() + assert (dataset_pth / "data" / "data_file.csv").exists() + def test_metadata(dataset: HDXDataSet): test_metadata = yaml.safe_load((TEST_PTH / "datasets" / DATA_ID / "metadata.yaml").read_text())