MCPcopy Index your code
hub / github.com/numpy/numpy / test_subarray_key

Method test_subarray_key

numpy/lib/tests/test_recfunctions.py:929–941  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

927 assert_equal(res.dtype, expected_dtype)
928
929 def test_subarray_key(self):
930 a_dtype = np.dtype([('pos', int, 3), ('f', '<f4')])
931 a = np.array([([1, 1, 1], np.pi), ([1, 2, 3], 0.0)], dtype=a_dtype)
932
933 b_dtype = np.dtype([('pos', int, 3), ('g', '<f4')])
934 b = np.array([([1, 1, 1], 3), ([3, 2, 1], 0.0)], dtype=b_dtype)
935
936 expected_dtype = np.dtype([('pos', int, 3), ('f', '<f4'), ('g', '<f4')])
937 expected = np.array([([1, 1, 1], np.pi, 3)], dtype=expected_dtype)
938
939 res = join_by('pos', a, b)
940 assert_equal(res.dtype, expected_dtype)
941 assert_equal(res, expected)
942
943 def test_padded_dtype(self):
944 dt = np.dtype('i1,f4', align=True)

Callers

nothing calls this directly

Calls 3

join_byFunction · 0.90
assert_equalFunction · 0.90
dtypeMethod · 0.45

Tested by

no test coverage detected