shithub: aubio

Download patch

ref: a4cc8e5d1443807ed8afb91b90349282cbbb14ce
parent: 0d222ee8b82a3bb852b652a083712b20c0b06519
author: Paul Brossier <[email protected]>
date: Mon Mar 4 17:58:05 EST 2013

tests/: array_from_file to look for file in tests/

--- a/python/tests/test_filter.py
+++ b/python/tests/test_filter.py
@@ -3,10 +3,7 @@
 from numpy.testing import TestCase, assert_equal, assert_almost_equal
 from aubio import fvec, digital_filter
 from numpy import array
-
-def array_from_text_file(filename, dtype = 'float'):
-  return array([line.split() for line in open(filename).readlines()], 
-      dtype = dtype)
+from utils import array_from_text_file
 
 class aubio_filter_test_case(TestCase):
 
--- a/python/tests/test_filterbank.py
+++ b/python/tests/test_filterbank.py
@@ -6,10 +6,7 @@
 from math import pi
 from numpy import array
 from aubio import cvec, filterbank
-
-def array_from_text_file(filename, dtype = 'float'):
-  return array([line.split() for line in open(filename).readlines()], 
-      dtype = dtype)
+from utils import array_from_text_file
 
 class aubio_filterbank_test_case(TestCase):
 
--- /dev/null
+++ b/python/tests/utils.py
@@ -1,0 +1,9 @@
+#! /usr/bin/env python
+
+def array_from_text_file(filename, dtype = 'float'):
+  import os.path
+  from numpy import array
+  filename = os.path.join(os.path.dirname(__file__), filename)
+  return array([line.split() for line in open(filename).readlines()], 
+      dtype = dtype)
+