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

Method testScale

tools/swig/test/testTensor.py:136–146  ·  view source on GitHub ↗

Test scale function

(self)

Source from the content-addressed store, hash-verified

134
135 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
136 def testScale(self):
137 "Test scale function"
138 print(self.typeStr, "... ", end=' ', file=sys.stderr)
139 scale = Tensor.__dict__[self.typeStr + "Scale"]
140 tensor = np.array([[[1, 0, 1], [0, 1, 0], [1, 0, 1]],
141 [[0, 1, 0], [1, 0, 1], [0, 1, 0]],
142 [[1, 0, 1], [0, 1, 0], [1, 0, 1]]], self.typeCode)
143 scale(tensor, 4)
144 self.assertEqual((tensor == [[[4, 0, 4], [0, 4, 0], [4, 0, 4]],
145 [[0, 4, 0], [4, 0, 4], [0, 4, 0]],
146 [[4, 0, 4], [0, 4, 0], [4, 0, 4]]]).all(), True)
147
148 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
149 def testScaleWrongType(self):

Callers

nothing calls this directly

Calls 2

printFunction · 0.85
allMethod · 0.45

Tested by

no test coverage detected