MCPcopy Index your code
hub / github.com/numpy/numpy / testOnes

Method testOnes

tools/swig/test/testVector.py:156–162  ·  view source on GitHub ↗

Test ones function

(self)

Source from the content-addressed store, hash-verified

154
155 # Test the (type* INPLACE_ARRAY1, int DIM1) typemap
156 def testOnes(self):
157 "Test ones function"
158 print(self.typeStr, "... ", end=' ', file=sys.stderr)
159 ones = Vector.__dict__[self.typeStr + "Ones"]
160 vector = np.zeros(5, self.typeCode)
161 ones(vector)
162 np.testing.assert_array_equal(vector, np.array([1, 1, 1, 1, 1]))
163
164 # Test the (type* INPLACE_ARRAY1, int DIM1) typemap
165 def testOnesWrongDim(self):

Callers

nothing calls this directly

Calls 1

onesFunction · 0.50

Tested by

no test coverage detected