(self, function, sz)
| 1904 | self.seeds = range(4) |
| 1905 | |
| 1906 | def check_function(self, function, sz): |
| 1907 | from threading import Thread |
| 1908 | |
| 1909 | out1 = np.empty((len(self.seeds),) + sz) |
| 1910 | out2 = np.empty((len(self.seeds),) + sz) |
| 1911 | |
| 1912 | # threaded generation |
| 1913 | t = [Thread(target=function, args=(random.RandomState(s), o)) |
| 1914 | for s, o in zip(self.seeds, out1)] |
| 1915 | [x.start() for x in t] |
| 1916 | [x.join() for x in t] |
| 1917 | |
| 1918 | # the same serial |
| 1919 | for s, o in zip(self.seeds, out2): |
| 1920 | function(random.RandomState(s), o) |
| 1921 | |
| 1922 | # these platforms change x87 fpu precision mode in threads |
| 1923 | if np.intp().dtype.itemsize == 4 and sys.platform == "win32": |
| 1924 | assert_array_almost_equal(out1, out2) |
| 1925 | else: |
| 1926 | assert_array_equal(out1, out2) |
| 1927 | |
| 1928 | def test_normal(self): |
| 1929 | def gen_random(state, out): |
no test coverage detected