shithub: aubio

Download patch

ref: 40b2be270e7f71b844a4fdd03f069345f21dbc3f
parent: 319edae161abb49fb75c7e6650685b3e7831e940
author: Paul Brossier <piem@piem.org>
date: Wed Oct 31 22:54:05 EDT 2018

[tests] move imports to top except main

--- a/python/tests/test_notes.py
+++ b/python/tests/test_notes.py
@@ -1,9 +1,12 @@
 #! /usr/bin/env python
 
-from unittest import main
 from numpy.testing import TestCase, assert_equal, assert_almost_equal
-from aubio import notes
+from aubio import notes, source
+import numpy as np
+from .utils import list_all_sounds
 
+list_of_sounds = list_all_sounds('sounds')
+
 AUBIO_DEFAULT_NOTES_SILENCE = -70.
 AUBIO_DEFAULT_NOTES_RELEASE_DROP = 10.
 AUBIO_DEFAULT_NOTES_MINIOI_MS = 30.
@@ -52,14 +55,9 @@
         with self.assertRaises(ValueError):
             self.o.set_release_drop(val)
 
-from .utils import list_all_sounds
-list_of_sounds = list_all_sounds('sounds')
-
 class aubio_notes_sinewave(TestCase):
 
     def analyze_file(self, filepath, samplerate=0):
-        from aubio import source
-        import numpy as np
         win_s = 512 # fft size
         hop_s = 256 # hop size
 
@@ -92,4 +90,5 @@
                 assert_equal (results[0][1], [69, 123, -1])
 
 if __name__ == '__main__':
+    from unittest import main
     main()