Skip to content

Commit 1c62752

Browse files
committed
tests(_internal/colors): Add test for heading() with colors enabled
Verify that heading() applies bright_cyan (ANSI 96) with bold when colors are enabled. Previously only the disabled case was tested. Also adds ANSI_BRIGHT_CYAN constant to conftest.py for test assertions.
1 parent 21b8f62 commit 1c62752

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

tests/_internal/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ANSI_BLUE = "\033[34m"
1515
ANSI_MAGENTA = "\033[35m"
1616
ANSI_CYAN = "\033[36m"
17+
ANSI_BRIGHT_CYAN = "\033[96m"
1718
ANSI_RESET = "\033[0m"
1819
ANSI_BOLD = "\033[1m"
1920

tests/_internal/test_colors.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from tests._internal.conftest import (
1010
ANSI_BLUE,
1111
ANSI_BOLD,
12+
ANSI_BRIGHT_CYAN,
1213
ANSI_CYAN,
1314
ANSI_GREEN,
1415
ANSI_MAGENTA,
@@ -297,3 +298,17 @@ def test_style_with_rgb_non_integer() -> None:
297298
"""style() should reject non-integer RGB values."""
298299
with pytest.raises(UnknownStyleColor):
299300
style("test", fg=(255.5, 128, 0)) # type: ignore[arg-type]
301+
302+
303+
# heading() method tests
304+
305+
306+
def test_heading_applies_bright_cyan_bold(monkeypatch: pytest.MonkeyPatch) -> None:
307+
"""heading() applies bright_cyan with bold when colors are enabled."""
308+
monkeypatch.delenv("NO_COLOR", raising=False)
309+
colors = Colors(ColorMode.ALWAYS)
310+
result = colors.heading("Local workspaces:")
311+
assert ANSI_BRIGHT_CYAN in result
312+
assert ANSI_BOLD in result
313+
assert "Local workspaces:" in result
314+
assert ANSI_RESET in result

0 commit comments

Comments
 (0)