File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,7 +397,8 @@ def test_tsv_reading_handles_both_line_endings(self):
397397 with open (tag_lf , "rb" ) as f :
398398 lf_content = f .read ()
399399
400- crlf_content = lf_content .replace (b"\n " , b"\r \n " )
400+ # Normalize to LF first, then convert to CRLF to avoid double carriage returns
401+ crlf_content = lf_content .replace (b"\r \n " , b"\n " ).replace (b"\n " , b"\r \n " )
401402
402403 # Write CRLF version
403404 os .makedirs (os .path .dirname (crlf_path ), exist_ok = True )
@@ -421,8 +422,9 @@ def test_tsv_reading_handles_both_line_endings(self):
421422 if os .path .exists (src ):
422423 with open (src , "rb" ) as f :
423424 content = f .read ()
425+ # Normalize to LF first, then convert to CRLF to avoid double carriage returns
424426 with open (dst , "wb" ) as f :
425- f .write (content .replace (b"\n " , b"\r \n " ))
427+ f .write (content .replace (b"\r \n " , b" \n " ). replace ( b" \ n " , b"\r \n " ))
426428
427429 # Both should load successfully
428430 lf_schema = load_schema (lf_path )
You can’t perform that action at this time.
0 commit comments