Coverage for tests/test_terminal.py: 100%
9 statements
« prev ^ index » next coverage.py v7.11.1, created at 2026-03-27 20:23 -0700
« prev ^ index » next coverage.py v7.11.1, created at 2026-03-27 20:23 -0700
1"""Test cases for the terminal module."""
3import sys
5from countdown import terminal
8def test_check_for_keypress_returns_false_when_not_a_tty():
9 """Test that check_for_keypress returns False when not a TTY."""
10 # Mock stdin.isatty() to return False
11 original_isatty = sys.stdin.isatty
12 sys.stdin.isatty = lambda: False
14 try:
15 result = terminal.check_for_keypress()
16 assert result is False, "Should return False when not a TTY"
17 finally:
18 sys.stdin.isatty = original_isatty