From f603b5758565757dc0969b563767c6c5f662fb54 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 8 Oct 2009 02:10:10 +0200 Subject: [PATCH] tests/python: update template.py --- tests/python/template.py | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.26.2