(self, function, sz)
| 1627 | self.seeds = range(4) |
| 1628 | |
| 1629 | def check_function(self, function, sz): |
| 1630 | from threading import Thread |
| 1631 | |
| 1632 | out1 = np.empty((len(self.seeds),) + sz) |
| 1633 | out2 = np.empty((len(self.seeds),) + sz) |
| 1634 | |
| 1635 | # threaded generation |
| 1636 | t = [Thread(target=function, args=(np.random.RandomState(s), o)) |
| 1637 | for s, o in zip(self.seeds, out1)] |
| 1638 | [x.start() for x in t] |
| 1639 | [x.join() for x in t] |
| 1640 | |
| 1641 | # the same serial |
| 1642 | for s, o in zip(self.seeds, out2): |
| 1643 | function(np.random.RandomState(s), o) |
| 1644 | |
| 1645 | # these platforms change x87 fpu precision mode in threads |
| 1646 | if np.intp().dtype.itemsize == 4 and sys.platform == "win32": |
| 1647 | assert_array_almost_equal(out1, out2) |
| 1648 | else: |
| 1649 | assert_array_equal(out1, out2) |
| 1650 | |
| 1651 | def test_normal(self): |
| 1652 | def gen_random(state, out): |
no test coverage detected