MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_newline

Method test_newline

Lib/test/test_zstd.py:2595–2603  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2593 self.assertEqual(f.read(), "foobar")
2594
2595 def test_newline(self):
2596 # Test with explicit newline (universal newline mode disabled).
2597 text = THIS_FILE_STR.replace(os.linesep, "\n")
2598 with io.BytesIO() as bio:
2599 with open(bio, "wt", encoding="utf-8", newline="\n") as f:
2600 f.write(text)
2601 bio.seek(0)
2602 with open(bio, "rt", encoding="utf-8", newline="\r") as f:
2603 self.assertEqual(f.readlines(), [text])
2604
2605 def test_x_mode(self):
2606 with tempfile.NamedTemporaryFile(delete=False) as tmp_f:

Callers

nothing calls this directly

Calls 6

openFunction · 0.90
replaceMethod · 0.45
writeMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45
readlinesMethod · 0.45

Tested by

no test coverage detected