forked from pycaret/pycaret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_datasets.py
80 lines (63 loc) · 1.95 KB
/
test_datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import pandas as pd
import pytest
from pycaret.datasets import get_data
def test_datasets():
#########################
# Load Local File ####
#########################
# # loading dataset
# os.chdir(os.path.dirname(os.path.realpath(__file__)))
# data = get_data("test_files/dummy_dataset")
# assert isinstance(data, pd.DataFrame)
# rows, cols = data.shape
# assert rows >= 1
# assert cols >= 1
##############################
# GitHub Common folder ####
##############################
# loading list of datasets
index = get_data("index")
assert isinstance(index, pd.DataFrame)
rows, cols = index.shape
assert rows > 1
assert cols == 8
# loading dataset
data = get_data("credit")
assert isinstance(data, pd.DataFrame)
rows, cols = data.shape
assert rows == 24000
assert cols == 24
assert data.size == 576000
################################
# GitHub Specific folder ####
################################
folder = "time_series/seasonal"
# loading list of datasets
index = get_data("index", folder=folder)
assert isinstance(index, pd.DataFrame)
rows, cols = index.shape
assert rows > 1
assert cols == 12
# loading dataset
data = get_data("1", folder=folder)
assert isinstance(data, pd.DataFrame)
rows, cols = data.shape
assert rows >= 1
assert cols >= 1
###########################
# `sktime` datasets ####
###########################
# loading dataset
data = get_data("airline")
assert isinstance(data, pd.Series)
rows = len(data)
assert rows >= 1
###########################
# Incorrect dataset ####
###########################
with pytest.raises(ValueError) as errmsg:
_ = get_data("wrong")
exceptionmsg = errmsg.value.args[0]
assert exceptionmsg == "Data could not be read. Please check your inputs..."
if __name__ == "__main__":
test_datasets()