A small code review is needed for a change in the report preview module.
Stack and run:
Feature context:
rows: Iterable[str].limit non-empty strings with surrounding whitespace stripped in the preview field.total field.strip() does not count as a record and must be ignored.build_window(...) must not affect each other.API contract:
build_window(rows, limit=3) -> dict{"preview": list[str], "total": int}.What to check in the review:
How to reproduce:
report_window.py.rows = (x for x in [" A ", "", "B", "C"])preview == ["A", "B"] and total == 3 when limit=2.build_window(["X"], limit=1)build_window(["Y"], limit=1)Assumptions:
limit <= 0, the preview must be empty, but total must still reflect the number of non-empty strings.CPython 3.12.2, standard library, run locally via python REPL or python -c.
Use line comments to explain the problem, its impact, the fix and how to test it.