History

tests/: array_from_file to look for file in tests/

Paul Brossier committed 13 years ago

Commit a4cc8e51 parent 0d222ee3 files · +11 −8Browse files

Showing the changes to python (3 of 3 files). Show all

Unified · Split

3 files
  1. python/tests/test_filter.py +1 −4
  2. python/tests/test_filterbank.py +1 −4
  3. python/tests/utils.py +9 −0
python/tests/test_filter.py+1−4
@@ -3,10 +3,7 @@ · 2 unmodified lines
33 from numpy.testing import TestCase, assert_equal, assert_almost_equal
44 from aubio import fvec, digital_filter
55 from numpy import array
6−
7−def array_from_text_file(filename, dtype = 'float'):
8− return array([line.split() for line in open(filename).readlines()],
9− dtype = dtype)
6+from utils import array_from_text_file
107
118 class aubio_filter_test_case(TestCase):
129
python/tests/test_filterbank.py+1−4
@@ -6,10 +6,7 @@ from numpy import random · 5 unmodified lines
66 from math import pi
77 from numpy import array
88 from aubio import cvec, filterbank
9−
10−def array_from_text_file(filename, dtype = 'float'):
11− return array([line.split() for line in open(filename).readlines()],
12− dtype = dtype)
9+from utils import array_from_text_file
1310
1411 class aubio_filterbank_test_case(TestCase):
1512
python/tests/utils.py+9−0
@@ -0,0 +1,9 @@
1+#! /usr/bin/env python
2+
3+def array_from_text_file(filename, dtype = 'float'):
4+ import os.path
5+ from numpy import array
6+ filename = os.path.join(os.path.dirname(__file__), filename)
7+ return array([line.split() for line in open(filename).readlines()],
8+ dtype = dtype)
9+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t