MCPcopy Create free account
hub / github.com/numpy/numpy / test_subarray_key

Method test_subarray_key

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

Source from the content-addressed store, hash-verified

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