2020-06-10 23:29:56 +02:00
|
|
|
from pandas import DataFrame
|
|
|
|
from requests import get
|
2020-06-12 19:21:50 +02:00
|
|
|
|
|
|
|
from app.preprocessing import create_dataframe
|
|
|
|
from app.data_request import request_dataset
|
2020-06-15 01:19:13 +02:00
|
|
|
from constants import COLUMNS, DATASETS, DATASET_URL
|
2020-06-10 21:50:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_dataset_request():
|
|
|
|
"""
|
|
|
|
Checks that the datasets URLs are reachable
|
|
|
|
"""
|
|
|
|
for dataset in DATASETS:
|
2020-06-15 01:19:13 +02:00
|
|
|
response = get(DATASET_URL.format(dataset))
|
2020-06-10 21:50:08 +02:00
|
|
|
assert response.status_code == 200
|
2020-05-27 20:45:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_dataframe_creation():
|
2020-06-10 21:50:08 +02:00
|
|
|
"""
|
|
|
|
Verifes that the DataFrames are created and filtered properly
|
|
|
|
"""
|
|
|
|
for dataset in DATASETS:
|
|
|
|
df = create_dataframe(dataset)
|
2020-05-27 20:45:21 +02:00
|
|
|
assert isinstance(df, DataFrame)
|
2020-06-12 19:21:50 +02:00
|
|
|
assert all(df.columns == COLUMNS[dataset])
|