Skip to content

Commit be2cc87

Browse files
committed
ENH: Remove restriction on writing newlines in header
1 parent 8e62e99 commit be2cc87

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

nibabel/streamlines/tck.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,6 @@ def _write_header(fileobj, header):
267267
)
268268
out = '\n'.join(lines)
269269

270-
# Check the header is well formatted.
271-
if out.count('\n') > len(lines) - 1: # \n only allowed between lines.
272-
msg = f"Key-value pairs cannot contain '\\n':\n{out}"
273-
raise HeaderError(msg)
274-
275270
if out.count(':') > len(lines):
276271
# : only one per line (except the last one which contains END).
277272
msg = f"Key-value pairs cannot contain ':':\n{out}"

nibabel/streamlines/tests/test_tck.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@ def test_write_simple_file(self):
192192
# TCK file containing not well formatted entries in its header.
193193
tck_file = BytesIO()
194194
tck = TckFile(tractogram)
195-
tck.header['new_entry'] = 'value\n' # \n not allowed
196-
with pytest.raises(HeaderError):
197-
tck.save(tck_file)
198-
199195
tck.header['new_entry'] = 'val:ue' # : not allowed
200196
with pytest.raises(HeaderError):
201197
tck.save(tck_file)

0 commit comments

Comments
 (0)