Show More
@@ -22,10 +22,10 except ImportError: | |||||
22 |
|
22 | |||
23 | # Third-party imports |
|
23 | # Third-party imports | |
24 | import nose.tools as nt |
|
24 | import nose.tools as nt | |
|
25 | import numpy | |||
25 |
|
26 | |||
26 | # Our own imports |
|
27 | # Our own imports | |
27 | from IPython.lib import display |
|
28 | from IPython.lib import display | |
28 | from IPython.testing.decorators import skipif_not_numpy |
|
|||
29 |
|
29 | |||
30 | #----------------------------------------------------------------------------- |
|
30 | #----------------------------------------------------------------------------- | |
31 | # Classes and functions |
|
31 | # Classes and functions | |
@@ -179,11 +179,19 def test_recursive_FileLinks(): | |||||
179 | actual = actual.split('\n') |
|
179 | actual = actual.split('\n') | |
180 | nt.assert_equal(len(actual), 2, actual) |
|
180 | nt.assert_equal(len(actual), 2, actual) | |
181 |
|
181 | |||
182 | @skipif_not_numpy |
|
|||
183 | def test_audio_from_file(): |
|
182 | def test_audio_from_file(): | |
184 | path = pjoin(dirname(__file__), 'test.wav') |
|
183 | path = pjoin(dirname(__file__), 'test.wav') | |
185 | display.Audio(filename=path) |
|
184 | display.Audio(filename=path) | |
186 |
|
185 | |||
|
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 | ||||
187 | def test_code_from_file(): |
|
195 | def test_code_from_file(): | |
188 | c = display.Code(filename=__file__) |
|
196 | c = display.Code(filename=__file__) | |
189 | assert c._repr_html_().startswith('<style>') |
|
197 | assert c._repr_html_().startswith('<style>') |
General Comments 0
You need to be logged in to leave comments.
Login now