Commit e703ffa1 authored by Cecconi Baptiste's avatar Cecconi Baptiste
Browse files

srn nda test

parent 9397a92f
# -*- coding: utf-8 -*-
from typing import Union
from pathlib import Path
......@@ -16,11 +17,23 @@ class BaseData:
class Data(BaseData, dataset="default"):
def __call__(cls, filepath: Path, dataset: str):
if dataset is None:
cls.get_dataset(filepath)
return BaseData._registry[dataset](filepath)
@staticmethod
def get_dataset(filepath):
if filepath.name.endswith(".cdf"):
BaseData._registry["cdf"].get_dataset(filepath)
class CdfData(BaseData, dataset="cdf"):
@staticmethod
def get_dataset(filepath):
pass
class SrnNdaRoutineJupEdrCdfData(BaseData, dataset="srn_nda_routine_jup_edr"):
pass
......
# -*- coding: utf-8 -*-
from maser.data import Data
from maser.data.data import CdfData
from maser.data.data import CdfData, SrnNdaRoutineJupEdrCdfData
from pathlib import Path
BASEDIR = Path("data")
def test_cdf_dataset():
data = Data(filepath="toto.txt", dataset="cdf")
assert isinstance(data, CdfData)
def test_srn_nda_routine_jup_edr_dataset():
data = Data(
filepath=BASEDIR
/ "nda"
/ "routine"
/ "srn_nda_routine_jup_edr_201601302247_201601310645_V12.cdf"
)
assert isinstance(data, SrnNdaRoutineJupEdrCdfData)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment