| 2313 | assert type(a[0]) is int |
| 2314 | |
| 2315 | def test_correct_hash_dict(self): |
| 2316 | # gh-8887 - __hash__ would be None despite tp_hash being set |
| 2317 | all_types = [np.dtype(t).type for t in np.typecodes["All"]] |
| 2318 | all_types = set(all_types) - {np.void} |
| 2319 | for t in all_types: |
| 2320 | if t is np.timedelta64: |
| 2321 | val = t(0, 's') |
| 2322 | elif t is np.datetime64: |
| 2323 | val = t('NAT', 'D') |
| 2324 | else: |
| 2325 | val = t() |
| 2326 | |
| 2327 | try: |
| 2328 | hash(val) |
| 2329 | except TypeError: |
| 2330 | assert_(t.__hash__ is None) |
| 2331 | except ValueError: |
| 2332 | assert_(t is np.timedelta64) |
| 2333 | assert_(t.__hash__ is not None) |
| 2334 | else: |
| 2335 | assert_(t.__hash__ is not None) |
| 2336 | |
| 2337 | def test_scalar_copy(self): |
| 2338 | scalar_types = set(np._core.sctypeDict.values()) |