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

Method check_function

numpy/random/tests/test_randomstate.py:1878–1898  ·  view source on GitHub ↗
(self, function, sz)

Source from the content-addressed store, hash-verified

1876 seeds = range(4)
1877
1878 def check_function(self, function, sz):
1879 from threading import Thread
1880
1881 out1 = np.empty((len(self.seeds),) + sz)
1882 out2 = np.empty((len(self.seeds),) + sz)
1883
1884 # threaded generation
1885 t = [Thread(target=function, args=(random.RandomState(s), o))
1886 for s, o in zip(self.seeds, out1)]
1887 [x.start() for x in t]
1888 [x.join() for x in t]
1889
1890 # the same serial
1891 for s, o in zip(self.seeds, out2):
1892 function(random.RandomState(s), o)
1893
1894 # these platforms change x87 fpu precision mode in threads
1895 if np.intp().dtype.itemsize == 4 and sys.platform == "win32":
1896 assert_array_almost_equal(out1, out2)
1897 else:
1898 assert_array_equal(out1, out2)
1899
1900 def test_normal(self):
1901 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