ref: 874ed554c0c2e670e329ac34691614d7a8710454
parent: e6b2a0c83c5a053ead70179e75c0c41aa678b4e7
author: Paul Brossier <piem@piem.org>
date: Thu Oct 8 00:24:19 EDT 2009
tests/python/template.py: factorise
--- a/tests/python/examples/template.py
+++ /dev/null
@@ -1,18 +1,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)
--- 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):
@@ -17,6 +18,22 @@
if round((second-first)/first, places) != 0:
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()],