Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_dataset_1(test_data):
path = Path(__file__).parents[0]
ds = Dataset()
assert ds._backend == 'pandas'
assert ds._paths == ('.',)
assert ds._prefix == ()
with pytest.warns(RuntimeWarning):
Dataset(str(path), str(path))
with pytest.raises(RuntimeError):
Dataset('no_exist_dir')
ds = Dataset(str(path), backend='pickle', prefix=('datatools',))
assert hasattr(ds, 'datatools_test')
tmp = '%s' % ds
assert 'Dataset' in tmp
def test_dataset_1(test_data):
path = Path(__file__).parents[0]
ds = Dataset()
assert ds._backend == 'pandas'
assert ds._paths == ('.',)
assert ds._prefix == ()
with pytest.warns(RuntimeWarning):
Dataset(str(path), str(path))
with pytest.raises(RuntimeError):
Dataset('no_exist_dir')
ds = Dataset(str(path), backend='pickle', prefix=('datatools',))
assert hasattr(ds, 'datatools_test')
tmp = '%s' % ds
assert 'Dataset' in tmp
def test_dataset_1(test_data):
path = Path(__file__).parents[0]
ds = Dataset()
assert ds._backend == 'pandas'
assert ds._paths == ('.',)
assert ds._prefix == ()
with pytest.warns(RuntimeWarning):
Dataset(str(path), str(path))
with pytest.raises(RuntimeError):
Dataset('no_exist_dir')
ds = Dataset(str(path), backend='pickle', prefix=('datatools',))
assert hasattr(ds, 'datatools_test')
tmp = '%s' % ds
assert 'Dataset' in tmp
def test_dataset_1(test_data):
path = Path(__file__).parents[0]
ds = Dataset()
assert ds._backend == 'pandas'
assert ds._paths == ('.',)
assert ds._prefix == ()
with pytest.warns(RuntimeWarning):
Dataset(str(path), str(path))
with pytest.raises(RuntimeError):
Dataset('no_exist_dir')
ds = Dataset(str(path), backend='pickle', prefix=('datatools',))
assert hasattr(ds, 'datatools_test')
tmp = '%s' % ds
assert 'Dataset' in tmp
def test_dataset_2(test_data):
path = Path(__file__).parents[0]
ds = Dataset(str(path), backend='pickle')
assert hasattr(ds, 'test')
tmp = ds.test
assert isinstance(tmp, list)
assert tmp == [[1, 2], [3, 4]]
tmp = ds.csv
assert hasattr(tmp, 'test')
tmp = tmp.test
assert isinstance(tmp, pd.DataFrame)
assert np.all(np.array([[0, 1, 2], [1, 3, 4]]) == tmp.values)
tmp = ds.csv(str(path / 'test.csv'))
assert np.all(np.array([[0, 1, 2], [1, 3, 4]]) == tmp.values)
tmp = ds.pandas