MCPcopy Index your code
hub / github.com/numpy/numpy / check_function

Method check_function

numpy/random/tests/test_generator_mt19937.py:2527–2547  ·  view source on GitHub ↗
(self, function, sz)

Source from the content-addressed store, hash-verified

2525 seeds = range(4)
2526
2527 def check_function(self, function, sz):
2528 from threading import Thread
2529
2530 out1 = np.empty((len(self.seeds),) + sz)
2531 out2 = np.empty((len(self.seeds),) + sz)
2532
2533 # threaded generation
2534 t = [Thread(target=function, args=(Generator(MT19937(s)), o))
2535 for s, o in zip(self.seeds, out1)]
2536 [x.start() for x in t]
2537 [x.join() for x in t]
2538
2539 # the same serial
2540 for s, o in zip(self.seeds, out2):
2541 function(Generator(MT19937(s)), o)
2542
2543 # these platforms change x87 fpu precision mode in threads
2544 if np.intp().dtype.itemsize == 4 and sys.platform == "win32":
2545 assert_array_almost_equal(out1, out2)
2546 else:
2547 assert_array_equal(out1, out2)
2548
2549 def test_normal(self):
2550 def gen_random(state, out):

Callers 3

test_normalMethod · 0.95
test_expMethod · 0.95
test_multinomialMethod · 0.95

Calls 3

assert_array_equalFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected