Add test coverage for LiveRender.last_render_height

Open Beginner friendly
#4,266 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing

Research direction

Read tests/test_live_render.py and the LiveRender.last_render_height implementation in rich/live_render.py. Add a focused test using a three-line renderable that checks the value is 0 before rendering and 3 afterward. Done when the test passes and covers the previously uncovered lines 39–41.

Written by the indexing model from the issue text.

Description

While reviewing the LiveRender tests, I noticed that last_render_height does not appear to have a direct unit test verifying its value after rendering.

I added a focused test with a three-line renderable and confirmed the expected behavior:

  • Before rendering, last_render_height returns 0.
  • After rendering three lines, last_render_height returns 3.

The test passes on the current main branch. In a focused coverage run, the existing test_live_render.py tests left lines 39 to 41 uncovered. Adding this test covered those lines and increased coverage for rich/live_render.py from 77% to 85%.

Would a focused unit test for this behavior be useful to add to tests/test_live_render.py?

Dominant language
Python
Stars
57.8k
Forks
2.6k
Avg merge
20m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Textualize/rich

All issues in Textualize/rich

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.