| 49 | assert_(res.shape == (2,) + index_array.shape) |
| 50 | |
| 51 | def test_refcounting(self): |
| 52 | objects = [object() for i in range(10)] |
| 53 | for mode in ('raise', 'clip', 'wrap'): |
| 54 | a = np.array(objects) |
| 55 | b = np.array([2, 2, 4, 5, 3, 5]) |
| 56 | a.take(b, out=a[:6], mode=mode) |
| 57 | del a |
| 58 | if HAS_REFCOUNT: |
| 59 | assert_(all(sys.getrefcount(o) == 3 for o in objects)) |
| 60 | # not contiguous, example: |
| 61 | a = np.array(objects * 2)[::2] |
| 62 | a.take(b, out=a[:6], mode=mode) |
| 63 | del a |
| 64 | if HAS_REFCOUNT: |
| 65 | assert_(all(sys.getrefcount(o) == 3 for o in objects)) |
| 66 | |
| 67 | def test_unicode_mode(self): |
| 68 | d = np.arange(10) |