(self)
| 678 | assert_equal(actual, desired) |
| 679 | |
| 680 | def test_shuffle(self): |
| 681 | # Test lists, arrays (of various dtypes), and multidimensional versions |
| 682 | # of both, c-contiguous or not: |
| 683 | for conv in [lambda x: np.array([]), |
| 684 | lambda x: x, |
| 685 | lambda x: np.asarray(x).astype(np.int8), |
| 686 | lambda x: np.asarray(x).astype(np.float32), |
| 687 | lambda x: np.asarray(x).astype(np.complex64), |
| 688 | lambda x: np.asarray(x).astype(object), |
| 689 | lambda x: [(i, i) for i in x], |
| 690 | lambda x: np.asarray([[i, i] for i in x]), |
| 691 | lambda x: np.vstack([x, x]).T, |
| 692 | # gh-11442 |
| 693 | lambda x: (np.asarray([(i, i) for i in x], |
| 694 | [("a", int), ("b", int)]) |
| 695 | .view(np.recarray)), |
| 696 | # gh-4270 |
| 697 | lambda x: np.asarray([(i, i) for i in x], |
| 698 | [("a", object, (1,)), |
| 699 | ("b", np.int32, (1,))])]: |
| 700 | random.seed(self.seed) |
| 701 | alist = conv([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) |
| 702 | random.shuffle(alist) |
| 703 | actual = alist |
| 704 | desired = conv([0, 1, 9, 6, 2, 4, 5, 8, 7, 3]) |
| 705 | assert_array_equal(actual, desired) |
| 706 | |
| 707 | def test_shuffle_masked(self): |
| 708 | # gh-3263 |
nothing calls this directly
no test coverage detected