summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2021-06-11 18:21:54 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2022-05-09 17:13:13 +0200
commita0c2e826738daa0cbd83aba85852405b73878f5b (patch)
tree337904e847c1e4cbee496f8afcf3110727f4f988 /numpy/testing
parent37cb0f8463345648add0e1e98fd146c966146981 (diff)
downloadnumpy-a0c2e826738daa0cbd83aba85852405b73878f5b.tar.gz
API: Fix structured dtype cast-safety, promotion, and comparison
This PR replaces the old gh-15509 implementing proper type promotion for structured voids. It further fixes the casting safety to consider casts with equivalent field number and matching order as "safe" and if the names, titles, and offsets match as "equiv". The change perculates into the void comparison, and since it fixes the order, it removes the current FutureWarning there as well. This addresses https://github.com/liberfa/pyerfa/issues/77 and replaces gh-15509 (the implementation has changed too much). Fixes gh-15494 (and probably a few more) Co-authored-by: Allan Haldane <allan.haldane@gmail.com>
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/tests/test_utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 919ca751f..bbc04124f 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -151,14 +151,13 @@ class TestArrayEqual(_GenericTest):
self._test_equal(a, b)
- c = np.empty(2, [('floupipi', float), ('floupa', float)])
+ c = np.empty(2, [('floupipi', float),
+ ('floupi', float), ('floupa', float)])
c['floupipi'] = a['floupi'].copy()
c['floupa'] = a['floupa'].copy()
- with suppress_warnings() as sup:
- l = sup.record(FutureWarning, message="elementwise == ")
+ with pytest.raises(TypeError):
self._test_not_equal(c, b)
- assert_equal(len(l), 1)
def test_masked_nan_inf(self):
# Regression test for gh-11121