Changeset 874ed55 for tests


Ignore:
Timestamp:
Oct 8, 2009, 4:24:19 AM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
ca0a821
Parents:
e6b2a0c
Message:

tests/python/template.py: factorise

Location:
tests/python
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • tests/python/template.py

    re6b2a0c r874ed55  
    11import unittest
     2from commands import getstatusoutput
    23from numpy import array
    34
     
    1920              (msg or '%r != %r within %r places' % (first, second, places))
    2021
     22class program_test_case(unittest.TestCase):
     23
     24  filename = "/dev/null"
     25  progname = "UNDEFINED"
     26  command = ""
     27  options = ""
     28
     29  def getOutput(self, expected_status = 0):
     30    self.command = self.progname + ' -i ' + self.filename + self.command
     31    self.command += self.options
     32    [self.status, self.output] = getstatusoutput(self.command)
     33    if expected_status != -1:
     34      assert self.status == expected_status, \
     35        "expected status was %s, got %s\nOutput was:\n%s" % \
     36        (expected_status, self.status, self.output)
     37
    2138def array_from_text_file(filename, dtype = 'float'):
    2239  return array([line.split() for line in open(filename).readlines()],
Note: See TracChangeset for help on using the changeset viewer.