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

Method test_order

numpy/lib/tests/test_function_base.py:264–279  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

262 assert_equal(a_copy[0, 0], 10)
263
264 def test_order(self):
265 # It turns out that people rely on np.copy() preserving order by
266 # default; changing this broke scikit-learn:
267 # github.com/scikit-learn/scikit-learn/commit/7842748cf777412c506a8c0ed28090711d3a3783 # noqa
268 a = np.array([[1, 2], [3, 4]])
269 assert_(a.flags.c_contiguous)
270 assert_(not a.flags.f_contiguous)
271 a_fort = np.array([[1, 2], [3, 4]], order="F")
272 assert_(not a_fort.flags.c_contiguous)
273 assert_(a_fort.flags.f_contiguous)
274 a_copy = np.copy(a)
275 assert_(a_copy.flags.c_contiguous)
276 assert_(not a_copy.flags.f_contiguous)
277 a_fort_copy = np.copy(a_fort)
278 assert_(not a_fort_copy.flags.c_contiguous)
279 assert_(a_fort_copy.flags.f_contiguous)
280
281 def test_subok(self):
282 mx = ma.ones(5)

Callers

nothing calls this directly

Calls 2

assert_Function · 0.90
copyMethod · 0.45

Tested by

no test coverage detected