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

Method test_array

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

Source from the content-addressed store, hash-verified

350
351class TestSaveTxt:
352 def test_array(self):
353 a = np.array([[1, 2], [3, 4]], float)
354 fmt = "%.18e"
355 c = BytesIO()
356 np.savetxt(c, a, fmt=fmt)
357 c.seek(0)
358 assert_equal(c.readlines(),
359 [asbytes((fmt + ' ' + fmt + '\n') % (1, 2)),
360 asbytes((fmt + ' ' + fmt + '\n') % (3, 4))])
361
362 a = np.array([[1, 2], [3, 4]], int)
363 c = BytesIO()
364 np.savetxt(c, a, fmt='%d')
365 c.seek(0)
366 assert_equal(c.readlines(), [b'1 2\n', b'3 4\n'])
367
368 def test_1D(self):
369 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