Evgeny Smyshlyaev
6 years ago
committed by
Alexey Velikiy
4 changed files with 72 additions and 20 deletions
@ -0,0 +1,30 @@
|
||||
import unittest |
||||
import pandas as pd |
||||
|
||||
from detectors import pattern_detector, threshold_detector |
||||
|
||||
class TestPatternDetector(unittest.TestCase): |
||||
|
||||
def test_small_dataframe(self): |
||||
|
||||
data = [[0,1], [1,2]] |
||||
dataframe = pd.DataFrame(data, columns=['timestamp', 'values']) |
||||
cache = {'WINDOW_SIZE': 10} |
||||
|
||||
detector = pattern_detector.PatternDetector('GENERAL', 'test_id') |
||||
|
||||
with self.assertRaises(ValueError): |
||||
detector.detect(dataframe, cache) |
||||
|
||||
|
||||
class TestThresholdDetector(unittest.TestCase): |
||||
|
||||
def test_invalid_cache(self): |
||||
|
||||
detector = threshold_detector.ThresholdDetector() |
||||
|
||||
with self.assertRaises(ValueError): |
||||
detector.detect([], None) |
||||
|
||||
with self.assertRaises(ValueError): |
||||
detector.detect([], {}) |
Loading…
Reference in new issue