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

Method testView

tools/swig/test/testArray.py:108–114  ·  view source on GitHub ↗

Test Array1 view method

(self)

Source from the content-addressed store, hash-verified

106 self.assertTrue(str(self.array1) == "[ -2, -1, 0, 1, 2 ]")
107
108 def testView(self):
109 "Test Array1 view method"
110 for i in range(self.array1.length()): self.array1[i] = i+1
111 a = self.array1.view()
112 self.assertTrue(isinstance(a, np.ndarray))
113 self.assertTrue(len(a) == self.length)
114 self.assertTrue((a == [1, 2, 3, 4, 5]).all())
115
116######################################################################
117

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.45
viewMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected