forked from AIStream-Peelout/flow-forecast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_preprocessing_ae.py
32 lines (28 loc) · 1011 Bytes
/
test_preprocessing_ae.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
from flood_forecast.preprocessing.preprocess_da_rnn import TrainData, format_data, make_data
import unittest
import pandas as pd
import os
class TestPreprocessingDA(unittest.TestCase):
def test_format_data(self):
df = pd.read_csv(
os.path.join(
os.path.dirname(__file__),
"test_data",
"test_format_data.csv"))
self.assertEqual(type(format_data(df, ["height"])), TrainData)
self.assertEqual(len(format_data(df, ["height"]).feats[0]), 2)
def test_make_function(self):
result = make_data(
os.path.join(
os.path.dirname(__file__),
"test_data",
"test_format_data.csv"),
target_col=["height"],
test_length=3,
relevant_cols=[
"temp",
"precip"])
self.assertEqual(len(result.feats), 4)
self.assertEqual(len(result.targs), 4)
if __name__ == '__main__':
unittest.main()