MCPcopy Create free account
hub / github.com/apple/coremltools / assert_references

Function assert_references

deps/pybind11/tests/test_numpy_array.py:192–209  ·  view source on GitHub ↗
(a, b, base=None)

Source from the content-addressed store, hash-verified

190
191def test_wrap():
192 def assert_references(a, b, base=None):
193 if base is None:
194 base = a
195 assert a is not b
196 assert a.__array_interface__["data"][0] == b.__array_interface__["data"][0]
197 assert a.shape == b.shape
198 assert a.strides == b.strides
199 assert a.flags.c_contiguous == b.flags.c_contiguous
200 assert a.flags.f_contiguous == b.flags.f_contiguous
201 assert a.flags.writeable == b.flags.writeable
202 assert a.flags.aligned == b.flags.aligned
203 assert a.flags.writebackifcopy == b.flags.writebackifcopy
204 assert np.all(a == b)
205 assert not b.flags.owndata
206 assert b.base is base
207 if a.flags.writeable and a.ndim == 2:
208 a[0, 0] = 1234
209 assert b[0, 0] == 1234
210
211 a1 = np.array([1, 2], dtype=np.int16)
212 assert a1.flags.owndata

Callers 1

test_wrapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected