8000 Update test_io.py to test implicit universal newlines · numpy/numpy@fc576da · GitHub
[go: up one dir, main page]

Skip to content

Commit fc576da

Browse files
authored
Update test_io.py to test implicit universal newlines
1 parent 295f5a8 commit fc576da

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

numpy/lib/tests/test_io.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,16 @@ def test_newline(self):
441441
a = np.array([(1, 2), (3, 4)])
442442
c = BytesIO()
443443

444-
# Native
444+
# Universal newline, implicit and explicit
445445
newline = os.linesep.encode()
446+
np.savetxt(c, a, fmt='%d')
447+
c.seek(0)
448+
assert_equal(c.readlines(), [b'1 2'+newline, b'3 4'+newline],
449+
err_msg='Universal newline, implicit')
446450
np.savetxt(c, a, fmt='%d', newline=None)
447451
c.seek(0)
448452
assert_equal(c.readlines(), [b'1 2'+newline, b'3 4'+newline],
449-
err_msg='Native newline')
453+
err_msg='Universal newline, explicit')
450454

451455
# POSIX
452456
newline = b'\n'
@@ -508,7 +512,7 @@ def test_header_footer(self):
508512
c.seek(0)
509513
assert_equal(c.read(),
510514
asbytes('1 2\n3 4\n' + commentstr + test_header_footer + '\n'))
511-
515+
512516
def test_file_roundtrip(self):
513517
with temppath() as name:
514518
a = np.array([(1, 2), (3, 4)])

0 commit comments

Comments
 (0)
0