MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_ndarray_2d

Method test_ndarray_2d

Lib/test/test_picklebuffer.py:85–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

83
84 @unittest.expectedFailure # TODO: RUSTPYTHON
85 def test_ndarray_2d(self):
86 # C-contiguous
87 ndarray = import_helper.import_module("_testbuffer").ndarray
88 arr = ndarray(list(range(12)), shape=(4, 3), format='<i')
89 self.assertTrue(arr.c_contiguous)
90 self.assertFalse(arr.f_contiguous)
91 pb = PickleBuffer(arr)
92 self.check_memoryview(pb, arr)
93 # Non-contiguous
94 arr = arr[::2]
95 self.assertFalse(arr.c_contiguous)
96 self.assertFalse(arr.f_contiguous)
97 pb = PickleBuffer(arr)
98 self.check_memoryview(pb, arr)
99 # F-contiguous
100 arr = ndarray(list(range(12)), shape=(3, 4), strides=(4, 12), format='<i')
101 self.assertTrue(arr.f_contiguous)
102 self.assertFalse(arr.c_contiguous)
103 pb = PickleBuffer(arr)
104 self.check_memoryview(pb, arr)
105
106 # Tests for PickleBuffer.raw()
107

Callers

nothing calls this directly

Calls 5

check_memoryviewMethod · 0.95
listClass · 0.85
assertTrueMethod · 0.80
assertFalseMethod · 0.80
import_moduleMethod · 0.45

Tested by

no test coverage detected