Skip to content
Myr

test_LazyFile.py

This file

Path

tests/test_utils/test_LazyFile.py

11 lines · 359 bytes · Python

Last changed by

Mark clearly functions private status. Deprecated Python 2 utilities. (#3695)Rowlando13before adoption333c28d

History of this file

Take it

Merge stable into main. (#3674)Rowlando13before adoption7925a34

lines 1–8why, one step back
1import click
234def test_iter_lazyfile(tmpdir):5 expected = list(map(str, range(10)))6 p = tmpdir.mkdir("testdir").join("testfile")7 p.write("\n".join(expected))8 with p.open() as f:

Mark clearly functions private status. Deprecated Python 2 utilities. (#3695)Rowlando13before adoption333c28d

line 9why, one step back
9 with click.utils._LazyFile(f.name) as lf:

Merge stable into main. (#3674)Rowlando13before adoption7925a34

lines 10–11why, one step back
10 for e_line, a_line in zip(expected, lf, strict=False):
11 assert e_line == a_line.strip()