def test_TableData_auto_file(tmpdir, fext): test_path = tmpdir.mkdir("sub").join("test{}".format(fext)) test_path_str = str(test_path) idx = range(1000) values = np.random.rand(len(idx)) raw = {"index": idx, "a": values, "b": values} meta = CoreMetaData({"identifier": "test", "structure": "test", "title": "test", "labels": ["index", "a", "b"], "units": [None, "kg", None]}) test = TableData() fout_factory = InterfaceFactory(AutoFileOutput) FOutCls = fout_factory(meta, test) fout = FOutCls() fout._path = test_path_str fout.data.result = test.get_data(raw, meta) fout.connect() assert len(tmpdir.listdir()) == 1 fin_factory = InterfaceFactory(AutoFileInput) FInCls = fin_factory(meta, test) fin = FInCls() fin._path = test_path_str fin.connect() result = test.get_data(fin.data.result, meta) assert "a" in result assert len(result) == len(idx)
def test_TableData(): idx = range(1000) values = np.random.rand(len(idx)) raw = {"index": idx, "a": values, "b": values} meta = CoreMetaData({"identifier": "test", "structure": "test", "title": "test", "labels": ["index", "a", "b"], "units": [None, "kg", None]}) test = TableData() a = test.get_data(raw, meta) b = test.get_value(a) assert "a" in b assert len(b) == len(idx)
def test_get_None(): test = TableData() result = test.get_value(None) assert result is None
def auto_output(self): TableData.auto_output(self) return
def auto_input(self): TableData.auto_input(self) return