MCPcopy
hub / github.com/numpy/numpy / testView

Method testView

tools/swig/test/testArray.py:365–372  ·  view source on GitHub ↗

Test ArrayZ view method

(self)

Source from the content-addressed store, hash-verified

363 self.assertTrue(str(self.array3) == "[ (-2,-4), (-1,-2), (0,0), (1,2), (2,4) ]")
364
365 def testView(self):
366 "Test ArrayZ view method"
367 for i in range(self.array3.length()):
368 self.array3[i] = complex(i + 1, i + 2)
369 a = self.array3.view()
370 self.assertTrue(isinstance(a, np.ndarray))
371 self.assertTrue(len(a) == self.length)
372 self.assertTrue((a == [1 + 2j, 2 + 3j, 3 + 4j, 4 + 5j, 5 + 6j]).all())
373
374######################################################################
375

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.80
viewMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected