Fix: Colored view displays empty list [] when all items are removed#573
Open
yannrouillard wants to merge 1 commit intoseperman:masterfrom
Open
Fix: Colored view displays empty list [] when all items are removed#573yannrouillard wants to merge 1 commit intoseperman:masterfrom
yannrouillard wants to merge 1 commit intoseperman:masterfrom
Conversation
8dcb758 to
e04f309
Compare
When comparing two lists where all items are removed (t2 becomes an empty list), the colored view would display an empty list [] instead of showing the removed items in red. The bug occurred because `_colorize_json()` returned '[]' immediately if the list was empty, without checking for items that were removed and should be displayed. Fix: Check for removed items before returning empty list representation. Added tests: - test_colored_view_list_all_items_removed - test_colored_compact_view_list_all_items_removed
a32af48 to
e7da467
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where COLORED_VIEW and COLORED_COMPACT_VIEW would display an empty list [] instead of showing removed items in red when all list items are removed.
Problem
When all items are removed from a list (t2 becomes empty), the colored view displays [] instead of the removed items in red.
Root Cause
In colored_view.py, _colorize_json() returned '[]' immediately when the list was empty, without checking for removed items.
Solution
Check for removed items before returning empty list representation.
Changes
Testing
All 18 tests pass including 2 new tests for this bug.