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

Method test_array

numpy/lib/tests/test_io.py:368–382  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

366
367class TestSaveTxt:
368 def test_array(self):
369 a = np.array([[1, 2], [3, 4]], float)
370 fmt = "%.18e"
371 c = BytesIO()
372 np.savetxt(c, a, fmt=fmt)
373 c.seek(0)
374 assert_equal(c.readlines(),
375 [asbytes((fmt + ' ' + fmt + '\n') % (1, 2)),
376 asbytes((fmt + ' ' + fmt + '\n') % (3, 4))])
377
378 a = np.array([[1, 2], [3, 4]], int)
379 c = BytesIO()
380 np.savetxt(c, a, fmt='%d')
381 c.seek(0)
382 assert_equal(c.readlines(), [b'1 2\n', b'3 4\n'])
383
384 def test_1D(self):
385 a = np.array([1, 2, 3, 4], int)

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
asbytesFunction · 0.90
seekMethod · 0.80

Tested by

no test coverage detected