MCPcopy Index your code
hub / github.com/python/cpython / test_newline

Method test_newline

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

Source from the content-addressed store, hash-verified

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