Add dataframe creation test

This commit is contained in:
coolneng 2020-05-27 20:45:21 +02:00
parent 65c88d13a1
commit 67968a8ad3
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
5 changed files with 15 additions and 6 deletions

View File

@ -10,7 +10,7 @@ filenames = {
"deconfinement-parking-relais-doublement-des-places": "relay-parking", "deconfinement-parking-relais-doublement-des-places": "relay-parking",
} }
files = { files = {
"cycling-paths": "../data/cycling-paths.json", "cycling-paths": "data/cycling-paths.json",
"relay-parking": "../data/relay-parking.json", "relay-parking": "data/relay-parking.json",
"home-delivery": "../data/home-delivery.json", "home-delivery": "data/home-delivery.json",
} }

View File

@ -1,6 +1,6 @@
from json import load from json import load
from pandas import read_json, json_normalize, DataFrame from pandas import json_normalize, DataFrame
from constants import files from app.constants import files
def open_json(dataset): def open_json(dataset):

View File

@ -6,7 +6,7 @@ from json import dump, dumps
def save_json(data, filename): def save_json(data, filename):
data_dir = "../data/" data_dir = "data/"
with open(data_dir + filename + ".json", "w") as f: with open(data_dir + filename + ".json", "w") as f:
dump(data, f, ensure_ascii=False) dump(data, f, ensure_ascii=False)

0
tests/__init__.py Normal file
View File

View File

@ -0,0 +1,9 @@
from app.constants import files
from app.preprocessing import create_dataframe
from pandas import DataFrame
def test_dataframe_creation():
for file in files.keys():
df = create_dataframe(file)
assert isinstance(df, DataFrame)