Skip to content

Commit 1a6963a

Browse files
committed
Revise for Python3.7
1 parent fc26be9 commit 1a6963a

File tree

6 files changed

+130
-17
lines changed

6 files changed

+130
-17
lines changed

tests/logai/algorithms/anomaly_detection_algo/test_anomaly_detector_het.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,3 @@ def test_het_anomaly_detector(self, log_counter_df):
2929
)
3030
res = model.fit_predict(counter_df)
3131
print(res.head())
32-
return
33-

tests/logai/algorithms/anomaly_detection_algo/test_dbl.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,3 @@ def test_dbl(self, log_counter_df):
4444
res = res.append(anom_score)
4545
assert (res.index == counter_df.index).all(), "Res.index should be identical to counter_df.index"
4646
assert len(res) == len(counter_df.index), "length of res should be equal to length of counter_df"
47-
48-
return
49-
50-
51-
52-

tests/logai/algorithms/anomaly_detection_algo/test_ets.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def setup(self):
2424
def test_ets_detector(self, log_counter_df):
2525
counter_df = log_counter_df
2626

27-
2827
ts_df = counter_df[[constants.LOG_COUNTS]]
2928
ts_df.index = counter_df[constants.LOG_TIMESTAMPS]
3029
counter_df["attribute"] = counter_df.drop([constants.LOG_COUNTS, constants.LOG_TIMESTAMPS], axis=1).apply(
@@ -58,6 +57,3 @@ def test_ets_detector(self, log_counter_df):
5857
print(len(res), counter_df.shape[0])
5958
assert (res.index == counter_df.index).all(), "Res.index should be identical to counter_df.index"
6059
assert len(res) == len(counter_df.index), "length of res should be equal to length of counter_df"
61-
62-
return
63-

tests/logai/algorithms/anomaly_detection_algo/test_one_class_svm.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ def test_fit_predict(self, log_features):
3333
assert isinstance(detector.model, OneClassSVM), "Model must be OneClassSVM"
3434
res = detector.predict(log_features)
3535
assert isinstance(res, pd.DataFrame), "result must be pd.DataFrame"
36-
37-
38-
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Action,ID,timestamp,Counts
2+
HiH_,30002312,2017-12-23 22:15:00,4
3+
HiH_,30002312,2017-12-23 22:30:00,2
4+
HiH_,30002312,2017-12-23 23:30:00,2
5+
HiH_,30002312,2017-12-24 00:30:00,2
6+
HiH_DataStatManager,30002312,2017-12-23 22:15:00,17
7+
HiH_HiAppUtil,30002312,2017-12-23 22:15:00,8
8+
HiH_HiBroadcastUtil,30002312,2017-12-23 22:15:00,2
9+
HiH_HiBroadcastUtil,30002312,2017-12-23 22:30:00,1
10+
HiH_HiBroadcastUtil,30002312,2017-12-23 23:30:00,1
11+
HiH_HiBroadcastUtil,30002312,2017-12-24 00:30:00,1
12+
HiH_HiHealthBinder,30002312,2017-12-23 22:15:00,9
13+
HiH_HiHealthDataInsertStore,30002312,2017-12-23 22:15:00,11
14+
HiH_HiSyncControl,30002312,2017-12-23 22:15:00,20
15+
HiH_HiSyncControl,30002312,2017-12-23 22:30:00,7
16+
HiH_HiSyncControl,30002312,2017-12-23 23:30:00,7
17+
HiH_HiSyncControl,30002312,2017-12-24 00:30:00,8
18+
HiH_HiSyncUtil,30002312,2017-12-23 22:15:00,2
19+
HiH_ListenerManager,30002312,2017-12-23 22:15:00,2
20+
Step_DataCache,30002312,2017-12-24 00:00:00,1
21+
Step_ExtSDM,30002312,2017-12-23 22:15:00,200
22+
Step_ExtSDM,30002312,2017-12-23 22:20:00,38
23+
Step_ExtSDM,30002312,2017-12-23 22:30:00,16
24+
Step_ExtSDM,30002312,2017-12-23 22:35:00,6
25+
Step_ExtSDM,30002312,2017-12-23 22:45:00,4
26+
Step_ExtSDM,30002312,2017-12-23 22:50:00,30
27+
Step_ExtSDM,30002312,2017-12-23 22:55:00,4
28+
Step_ExtSDM,30002312,2017-12-23 23:05:00,14
29+
Step_ExtSDM,30002312,2017-12-23 23:10:00,32
30+
Step_ExtSDM,30002312,2017-12-23 23:15:00,14
31+
Step_ExtSDM,30002312,2017-12-23 23:20:00,4
32+
Step_ExtSDM,30002312,2017-12-23 23:25:00,4
33+
Step_ExtSDM,30002312,2017-12-23 23:35:00,4
34+
Step_ExtSDM,30002312,2017-12-23 23:40:00,6
35+
Step_ExtSDM,30002312,2017-12-23 23:45:00,4
36+
Step_ExtSDM,30002312,2017-12-23 23:50:00,38
37+
Step_ExtSDM,30002312,2017-12-23 23:55:00,16
38+
Step_ExtSDM,30002312,2017-12-24 00:00:00,8
39+
Step_ExtSDM,30002312,2017-12-24 00:05:00,20
40+
Step_ExtSDM,30002312,2017-12-24 00:10:00,12
41+
Step_ExtSDM,30002312,2017-12-24 00:15:00,2
42+
Step_ExtSDM,30002312,2017-12-24 00:25:00,6
43+
Step_FlushableStepDataCache,30002312,2017-12-23 22:15:00,8
44+
Step_HGNH,30002312,2017-12-24 00:00:00,2
45+
Step_LSC,30002312,2017-12-23 22:15:00,223
46+
Step_LSC,30002312,2017-12-23 22:20:00,46
47+
Step_LSC,30002312,2017-12-23 22:25:00,3
48+
Step_LSC,30002312,2017-12-23 22:30:00,34
49+
Step_LSC,30002312,2017-12-23 22:35:00,16
50+
Step_LSC,30002312,2017-12-23 22:40:00,5
51+
Step_LSC,30002312,2017-12-23 22:45:00,9
52+
Step_LSC,30002312,2017-12-23 22:50:00,47
53+
Step_LSC,30002312,2017-12-23 22:55:00,12
54+
Step_LSC,30002312,2017-12-23 23:00:00,3
55+
Step_LSC,30002312,2017-12-23 23:05:00,31
56+
Step_LSC,30002312,2017-12-23 23:10:00,46
57+
Step_LSC,30002312,2017-12-23 23:15:00,25
58+
Step_LSC,30002312,2017-12-23 23:20:00,9
59+
Step_LSC,30002312,2017-12-23 23:25:00,9
60+
Step_LSC,30002312,2017-12-23 23:30:00,5
61+
Step_LSC,30002312,2017-12-23 23:35:00,9
62+
Step_LSC,30002312,2017-12-23 23:40:00,11
63+
Step_LSC,30002312,2017-12-23 23:45:00,9
64+
Step_LSC,30002312,2017-12-23 23:50:00,43
65+
Step_LSC,30002312,2017-12-23 23:55:00,21
66+
Step_LSC,30002312,2017-12-24 00:00:00,12
67+
Step_LSC,30002312,2017-12-24 00:05:00,25
68+
Step_LSC,30002312,2017-12-24 00:10:00,17
69+
Step_LSC,30002312,2017-12-24 00:15:00,7
70+
Step_LSC,30002312,2017-12-24 00:20:00,5
71+
Step_LSC,30002312,2017-12-24 00:25:00,10
72+
Step_LSC,30002312,2017-12-24 00:30:00,2
73+
Step_LSC,30002312,2017-12-24 00:35:00,3
74+
Step_LSC,30002312,2017-12-24 00:40:00,1
75+
Step_LSC,30002312,2017-12-24 00:45:00,3
76+
Step_LSC,30002312,2017-12-24 00:50:00,3
77+
Step_LSC,30002312,2017-12-24 00:55:00,3
78+
Step_LSC,30002312,2017-12-24 01:00:00,2
79+
Step_NotificationUtil,30002312,2017-12-24 00:00:00,1
80+
Step_SPUtils,30002312,2017-12-23 22:15:00,202
81+
Step_SPUtils,30002312,2017-12-23 22:20:00,38
82+
Step_SPUtils,30002312,2017-12-23 22:30:00,16
83+
Step_SPUtils,30002312,2017-12-23 22:35:00,6
84+
Step_SPUtils,30002312,2017-12-23 22:45:00,4
85+
Step_SPUtils,30002312,2017-12-23 22:50:00,30
86+
Step_SPUtils,30002312,2017-12-23 22:55:00,4
87+
Step_SPUtils,30002312,2017-12-23 23:05:00,14
88+
Step_SPUtils,30002312,2017-12-23 23:10:00,32
89+
Step_SPUtils,30002312,2017-12-23 23:15:00,14
90+
Step_SPUtils,30002312,2017-12-23 23:20:00,4
91+
Step_SPUtils,30002312,2017-12-23 23:25:00,4
92+
Step_SPUtils,30002312,2017-12-23 23:35:00,4
93+
Step_SPUtils,30002312,2017-12-23 23:40:00,6
94+
Step_SPUtils,30002312,2017-12-23 23:45:00,4
95+
Step_SPUtils,30002312,2017-12-23 23:50:00,38
96+
Step_SPUtils,30002312,2017-12-23 23:55:00,16
97+
Step_SPUtils,30002312,2017-12-24 00:00:00,18
98+
Step_SPUtils,30002312,2017-12-24 00:05:00,20
99+
Step_SPUtils,30002312,2017-12-24 00:10:00,12
100+
Step_SPUtils,30002312,2017-12-24 00:15:00,2
101+
Step_SPUtils,30002312,2017-12-24 00:25:00,6
102+
Step_ScreenUtil,30002312,2017-12-23 22:15:00,1
103+
Step_StandReportReceiver,30002312,2017-12-23 22:15:00,100
104+
Step_StandReportReceiver,30002312,2017-12-23 22:20:00,15
105+
Step_StandReportReceiver,30002312,2017-12-23 22:25:00,1
106+
Step_StandReportReceiver,30002312,2017-12-23 22:30:00,8
107+
Step_StandReportReceiver,30002312,2017-12-23 22:35:00,3
108+
Step_StandReportReceiver,30002312,2017-12-23 22:50:00,12
109+
Step_StandReportReceiver,30002312,2017-12-23 22:55:00,4
110+
Step_StandReportReceiver,30002312,2017-12-23 23:05:00,6
111+
Step_StandReportReceiver,30002312,2017-12-23 23:10:00,14
112+
Step_StandReportReceiver,30002312,2017-12-23 23:15:00,6
113+
Step_StandReportReceiver,30002312,2017-12-24 00:00:00,1
114+
Step_StandReportReceiver,30002312,2017-12-24 00:25:00,1
115+
Step_StandStepCounter,30002312,2017-12-23 22:15:00,3
116+
Step_StandStepCounter,30002312,2017-12-23 22:20:00,1
117+
Step_StandStepCounter,30002312,2017-12-23 22:30:00,3
118+
Step_StandStepCounter,30002312,2017-12-23 22:35:00,1
119+
Step_StandStepCounter,30002312,2017-12-23 22:50:00,4
120+
Step_StandStepCounter,30002312,2017-12-23 22:55:00,1
121+
Step_StandStepCounter,30002312,2017-12-23 23:05:00,1
122+
Step_StandStepCounter,30002312,2017-12-23 23:10:00,1
123+
Step_StandStepCounter,30002312,2017-12-23 23:15:00,2
124+
Step_StandStepCounter,30002312,2017-12-24 00:00:00,2
125+
Step_StandStepDataManager,30002312,2017-12-24 00:00:00,5

tests/logai/test_utils/fixtures.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ def log_features():
5858

5959
@pytest.fixture
6060
def log_counter_df():
61-
path = os.path.join(TEST_DATA_PATH, "default_counter_df")
62-
counter_df = pd.read_pickle(path)
61+
path = os.path.join(TEST_DATA_PATH, "default_counter_df.csv")
62+
# counter_df = pd.read_pickle(path)
63+
counter_df = pd.read_csv(path)
6364
counter_df.columns = [
6465
"Action",
6566
"ID",
6667
constants.LOG_TIMESTAMPS,
6768
constants.LOG_COUNTS,
6869
]
70+
counter_df[constants.LOG_TIMESTAMPS] = \
71+
pd.to_datetime(counter_df[constants.LOG_TIMESTAMPS])
6972
return counter_df
7073

7174

0 commit comments

Comments
 (0)