MCPcopy Create free account
hub / github.com/numpy/numpy / _test_mtsame

Method _test_mtsame

numpy/fft/tests/test_pocketfft.py:276–292  ·  view source on GitHub ↗
(self, func, *args)

Source from the content-addressed store, hash-verified

274 input_shape = (800, 200)
275
276 def _test_mtsame(self, func, *args):
277 def worker(args, q):
278 q.put(func(*args))
279
280 q = queue.Queue()
281 expected = func(*args)
282
283 # Spin off a bunch of threads to call the same function simultaneously
284 t = [threading.Thread(target=worker, args=(args, q))
285 for i in range(self.threads)]
286 [x.start() for x in t]
287
288 [x.join() for x in t]
289 # Make sure all threads returned the correct value
290 for i in range(self.threads):
291 assert_array_equal(q.get(timeout=5), expected,
292 'Function returned wrong value in multithreaded context')
293
294 def test_fft(self):
295 a = np.ones(self.input_shape) * 1+0j

Callers 4

test_fftMethod · 0.95
test_ifftMethod · 0.95
test_rfftMethod · 0.95
test_irfftMethod · 0.95

Calls 4

assert_array_equalFunction · 0.90
funcFunction · 0.50
joinMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected