File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323# Third-party imports
2424import nose .tools as nt
25+ import numpy
2526
2627# Our own imports
2728from IPython .lib import display
28- from IPython .testing .decorators import skipif_not_numpy
2929
3030#-----------------------------------------------------------------------------
3131# Classes and functions
@@ -179,11 +179,19 @@ def test_recursive_FileLinks():
179179 actual = actual .split ('\n ' )
180180 nt .assert_equal (len (actual ), 2 , actual )
181181
182- @skipif_not_numpy
183182def test_audio_from_file ():
184183 path = pjoin (dirname (__file__ ), 'test.wav' )
185184 display .Audio (filename = path )
186185
186+ def test_audio_from_numpy_array ():
187+ display .Audio (get_test_tone (), rate = 44100 )
188+
189+ def test_audio_from_numpy_array_without_rate_raises ():
190+ nt .assert_raises (ValueError , display .Audio , get_test_tone ())
191+
192+ def get_test_tone ():
193+ return numpy .sin (2 * numpy .pi * 440 * numpy .linspace (0 , 1 , 44100 ))
194+
187195def test_code_from_file ():
188196 c = display .Code (filename = __file__ )
189197 assert c ._repr_html_ ().startswith ('<style>' )
You can’t perform that action at this time.
0 commit comments