MCPcopy
hub / github.com/numpy/numpy / check_function

Method check_function

numpy/random/tests/test_random.py:1601–1621  ·  view source on GitHub ↗
(self, function, sz)

Source from the content-addressed store, hash-verified

1599 seeds = range(4)
1600
1601 def check_function(self, function, sz):
1602 from threading import Thread
1603
1604 out1 = np.empty((len(self.seeds),) + sz)
1605 out2 = np.empty((len(self.seeds),) + sz)
1606
1607 # threaded generation
1608 t = [Thread(target=function, args=(np.random.RandomState(s), o))
1609 for s, o in zip(self.seeds, out1)]
1610 [x.start() for x in t]
1611 [x.join() for x in t]
1612
1613 # the same serial
1614 for s, o in zip(self.seeds, out2):
1615 function(np.random.RandomState(s), o)
1616
1617 # these platforms change x87 fpu precision mode in threads
1618 if np.intp().dtype.itemsize == 4 and sys.platform == "win32":
1619 assert_array_almost_equal(out1, out2)
1620 else:
1621 assert_array_equal(out1, out2)
1622
1623 def test_normal(self):
1624 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