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

Method test_rename_fields

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

Source from the content-addressed store, hash-verified

95 assert_equal(test, control)
96
97 def test_rename_fields(self):
98 # Test rename fields
99 a = np.array([(1, (2, [3.0, 30.])), (4, (5, [6.0, 60.]))],
100 dtype=[('a', int),
101 ('b', [('ba', float), ('bb', (float, 2))])])
102 test = rename_fields(a, {'a': 'A', 'bb': 'BB'})
103 newdtype = [('A', int), ('b', [('ba', float), ('BB', (float, 2))])]
104 control = a.view(newdtype)
105 assert_equal(test.dtype, newdtype)
106 assert_equal(test, control)
107
108 def test_get_names(self):
109 # Test get_names

Callers

nothing calls this directly

Calls 3

rename_fieldsFunction · 0.90
assert_equalFunction · 0.90
viewMethod · 0.45

Tested by

no test coverage detected