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

Method testAsString

tools/swig/test/testArray.py:232–244  ·  view source on GitHub ↗

Test Array2 asString method

(self)

Source from the content-addressed store, hash-verified

230 self.assertRaises(IndexError, self.array2.__getitem__, self.nrows+1)
231
232 def testAsString(self):
233 "Test Array2 asString method"
234 result = """\
235[ [ 0, 1, 2, 3 ],
236 [ 1, 2, 3, 4 ],
237 [ 2, 3, 4, 5 ],
238 [ 3, 4, 5, 6 ],
239 [ 4, 5, 6, 7 ] ]
240"""
241 for i in range(self.nrows):
242 for j in range(self.ncols):
243 self.array2[i][j] = i+j
244 self.assertTrue(self.array2.asString() == result)
245
246 def testStr(self):
247 "Test Array2 __str__ method"

Callers

nothing calls this directly

Calls 1

asStringMethod · 0.45

Tested by

no test coverage detected