From: Paul Brossier Date: Thu, 8 Oct 2009 02:24:19 +0000 (+0200) Subject: tests/python/template.py: factorise X-Git-Tag: bzr2git~167 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=874ed554c0c2e670e329ac34691614d7a8710454;p=aubio.git tests/python/template.py: factorise --- diff --git a/tests/python/examples/template.py b/tests/python/examples/template.py deleted file mode 100644 index a30e08e0..00000000 --- a/tests/python/examples/template.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest -from commands import getstatusoutput - -class program_test_case(unittest.TestCase): - - filename = "/dev/null" - progname = "UNDEFINED" - command = "" - options = "" - - def getOutput(self, expected_status = 0): - self.command = self.progname + ' -i ' + self.filename + self.command - self.command += self.options - [self.status, self.output] = getstatusoutput(self.command) - if expected_status != -1: - assert self.status == expected_status, \ - "expected status was %s, got %s\nOutput was:\n%s" % \ - (expected_status, self.status, self.output) diff --git a/tests/python/template.py b/tests/python/template.py index 00e5344b..c0b1d126 100644 --- a/tests/python/template.py +++ b/tests/python/template.py @@ -1,4 +1,5 @@ import unittest +from commands import getstatusoutput from numpy import array class aubio_unit_template(unittest.TestCase): @@ -18,6 +19,22 @@ class aubio_unit_template(unittest.TestCase): raise self.failureException, \ (msg or '%r != %r within %r places' % (first, second, places)) +class program_test_case(unittest.TestCase): + + filename = "/dev/null" + progname = "UNDEFINED" + command = "" + options = "" + + def getOutput(self, expected_status = 0): + self.command = self.progname + ' -i ' + self.filename + self.command + self.command += self.options + [self.status, self.output] = getstatusoutput(self.command) + if expected_status != -1: + assert self.status == expected_status, \ + "expected status was %s, got %s\nOutput was:\n%s" % \ + (expected_status, self.status, self.output) + def array_from_text_file(filename, dtype = 'float'): return array([line.split() for line in open(filename).readlines()], dtype = dtype)