[lang-ref] ( read_file_as_text ) ( python )

def test_read_file_as_text(tmp_path):
    # f.read()
    lines = ['test message %03d\n' % x for x in range(5)]
    text  = ''.join(lines)
    p = tmp_path / 'a.txt'

    with p.open('w') as f:
        f.write(text)

    with p.open() as f:
        r = f.read()

    assert r == text