NASA_OSDR / tests /test_nasa_osdr.py
anz2's picture
fix data access issues
7ca8ff6
import datasets
from datasets import DatasetInfo, DownloadManager
from NASA_OSDR import NasaOsdr
def test_inherit_generator_base_builder_works():
class Child(datasets.GeneratorBasedBuilder):
BUILDER_CONFIGS = [
datasets.BuilderConfig(
name="some dataset",
version=datasets.Version("1.0.0"),
description="some description",
)
]
DEFAULT_CONFIG_NAME = "some dataset"
def _info(self) -> DatasetInfo:
return datasets.DatasetInfo(
description="""dadada """,
features=None,
supervised_keys=None,
homepage="dada",
license="dada",
citation="dsada",
)
child = Child()
assert child
def test_generate_examples():
dataset = NasaOsdr()
train_data = dataset._generate_examples(assays_file='data/assays.csv', samples_file='data/samples.csv')
idx, sample = next(iter(train_data))
print(idx, sample.keys())
def test_load_dataset():
from datasets import load_dataset
dataset = load_dataset("nasa_osdr.py")
print(len(dataset["train"]))
# def test_load_dataset2():
# from datasets import load_dataset
# dataset = load_dataset("anz2/NASA_OSDR", use_auth_token="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")
# print(len(dataset["test"]))