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