##// END OF EJS Templates
more skipping numpy when not installed
Matthias Bussonnier -
Show More
@@ -239,7 +239,11 b' class TestAudioDataWithNumpy(TestCase):'
239 lambda: display.Audio([-1.001], rate=44100, normalize=False))
239 lambda: display.Audio([-1.001], rate=44100, normalize=False))
240
240
241 def simulate_numpy_not_installed():
241 def simulate_numpy_not_installed():
242 return mock.patch('numpy.array', mock.MagicMock(side_effect=ImportError))
242 try:
243 import numpy
244 return mock.patch('numpy.array', mock.MagicMock(side_effect=ImportError))
245 except ModuleNotFoundError:
246 return lambda x:x
243
247
244 @simulate_numpy_not_installed()
248 @simulate_numpy_not_installed()
245 class TestAudioDataWithoutNumpy(TestAudioDataWithNumpy):
249 class TestAudioDataWithoutNumpy(TestAudioDataWithNumpy):
@@ -252,6 +256,7 b' class TestAudioDataWithoutNumpy(TestAudioDataWithNumpy):'
252 TypeError,
256 TypeError,
253 lambda: display.Audio(stereo_signal, rate=44100))
257 lambda: display.Audio(stereo_signal, rate=44100))
254
258
259 @skipif_not_numpy
255 def get_test_tone(scale=1):
260 def get_test_tone(scale=1):
256 return numpy.sin(2 * numpy.pi * 440 * numpy.linspace(0, 1, 44100)) * scale
261 return numpy.sin(2 * numpy.pi * 440 * numpy.linspace(0, 1, 44100)) * scale
257
262
General Comments 0
You need to be logged in to leave comments. Login now