From: Paul Brossier Date: Thu, 8 Oct 2009 00:10:10 +0000 (+0200) Subject: tests/python: update template.py X-Git-Tag: bzr2git~177 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f603b5758565757dc0969b563767c6c5f662fb54;p=aubio.git tests/python: update template.py --- diff --git a/tests/python/template.py b/tests/python/template.py index 05d1374e..00e5344b 100644 --- a/tests/python/template.py +++ b/tests/python/template.py @@ -1,6 +1,8 @@ import unittest +from numpy import array class aubio_unit_template(unittest.TestCase): + """ a class derivated from unittest.TestCase """ def assertCloseEnough(self, first, second, places=5, msg=None): """Fail if the two objects are unequal as determined by their @@ -15,3 +17,7 @@ class aubio_unit_template(unittest.TestCase): if round((second-first)/first, places) != 0: raise self.failureException, \ (msg or '%r != %r within %r places' % (first, second, places)) + +def array_from_text_file(filename, dtype = 'float'): + return array([line.split() for line in open(filename).readlines()], + dtype = dtype)