From: yomguy Date: Wed, 19 Oct 2011 09:21:46 +0000 (+0000) Subject: add simple test X-Git-Tag: 0.3.2~22 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2982350a56dd86584bc68099196c86e51dc9c36f;p=timeside.git add simple test --- diff --git a/timeside/tests/api/test_analyzer3.py b/timeside/tests/api/test_analyzer3.py new file mode 100644 index 0000000..31b4604 --- /dev/null +++ b/timeside/tests/api/test_analyzer3.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +import timeside +import sys +import os.path +import numpy +import time + + +class TestAnalyzer: + + analyzer = timeside.analyzer.MaxLevel() + + def __init__(self, path): + self.source = os.path.join(os.path.dirname(__file__), path) + print "Processing %s" % self.source + self.decoder = timeside.decoder.FileDecoder(self.source) + print 'format: ', self.decoder.format() + self.pipe = self.decoder + self.sub_pipe = self.analyzer + + def process(self): + self.pipe = self.pipe | self.sub_pipe + self.pipe.run() + + def results(self): + print {'name':self.analyzer.name(), + 'id':self.analyzer.id(), + 'unit':self.analyzer.unit(), + 'value':str(value)} + +test = TestAnalyzer(sys.argv[-1]) +test.process() +test.results()