(self, function, sz)
| 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): |
no test coverage detected