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

Method check_function

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

Source from the content-addressed store, hash-verified

2482 self.seeds = range(4)
2483
2484 def check_function(self, function, sz):
2485 from threading import Thread
2486
2487 out1 = np.empty((len(self.seeds),) + sz)
2488 out2 = np.empty((len(self.seeds),) + sz)
2489
2490 # threaded generation
2491 t = [Thread(target=function, args=(Generator(MT19937(s)), o))
2492 for s, o in zip(self.seeds, out1)]
2493 [x.start() for x in t]
2494 [x.join() for x in t]
2495
2496 # the same serial
2497 for s, o in zip(self.seeds, out2):
2498 function(Generator(MT19937(s)), o)
2499
2500 # these platforms change x87 fpu precision mode in threads
2501 if np.intp().dtype.itemsize == 4 and sys.platform == "win32":
2502 assert_array_almost_equal(out1, out2)
2503 else:
2504 assert_array_equal(out1, out2)
2505
2506 def test_normal(self):
2507 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.45

Tested by

no test coverage detected