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

Method test_flatten

numpy/core/tests/test_multiarray.py:3123–3135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3121 self.assert_partitioned(np.array(d)[p],[1])
3122
3123 def test_flatten(self):
3124 x0 = np.array([[1, 2, 3], [4, 5, 6]], np.int32)
3125 x1 = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], np.int32)
3126 y0 = np.array([1, 2, 3, 4, 5, 6], np.int32)
3127 y0f = np.array([1, 4, 2, 5, 3, 6], np.int32)
3128 y1 = np.array([1, 2, 3, 4, 5, 6, 7, 8], np.int32)
3129 y1f = np.array([1, 5, 3, 7, 2, 6, 4, 8], np.int32)
3130 assert_equal(x0.flatten(), y0)
3131 assert_equal(x0.flatten('F'), y0f)
3132 assert_equal(x0.flatten('F'), x0.T.flatten())
3133 assert_equal(x1.flatten(), y1)
3134 assert_equal(x1.flatten('F'), y1f)
3135 assert_equal(x1.flatten('F'), x1.T.flatten())
3136
3137
3138 @pytest.mark.parametrize('func', (np.dot, np.matmul))

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
flattenMethod · 0.80

Tested by

no test coverage detected