8000 Add test cases for empty values · python/cpython@5027272 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5027272

Browse files
committed
Add test cases for empty values
1 parent 621e4ab commit 5027272

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/test/test__colorize.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ def check(env, fallback, expected):
4444
check({'TERM': ''}, fallback, fallback)
4545
check({'FORCE_COLOR': '1'}, fallback, True)
4646
check({'FORCE_COLOR': '0'}, fallback, True)
47+
check({'FORCE_COLOR': ''}, fallback, fallback)
4748
check({'NO_COLOR': '1'}, fallback, False)
4849
check({'NO_COLOR': '0'}, fallback, False)
50+
check({'NO_COLOR': ''}, fallback, fallback)
4951

5052
check({'TERM': 'dumb', 'FORCE_COLOR': '1'}, False, True)
5153
check({'FORCE_COLOR': '1', 'NO_COLOR': '1'}, True, False)
54+
check({'FORCE_COLOR': '1', 'NO_COLOR': ''}, True, True)
55+
check({'FORCE_COLOR': '', 'NO_COLOR': '1'}, True, False)
56+
check({'FORCE_COLOR': '', 'NO_COLOR': ''}, True, True)
5257

5358
for ignore_environment in False, True:
5459
# Simulate running with or without `-E`.
@@ -64,7 +69,9 @@ def check(env, fallback, expected):
6469

6570
check({'TERM': 'dumb', 'PYTHON_COLORS': '1'}, False, not ignore_environment)
6671
check({'NO_COLOR': '1', 'PYTHON_COLORS': '1'}, False, not ignore_environment)
72+
check({'NO_COLOR': '', 'PYTHON_COLORS': '1'}, False, not ignore_environment)
6773
check({'FORCE_COLOR': '1', 'PYTHON_COLORS': '0'}, True, ignore_environment)
74+
check({'FORCE_COLOR': '', 'PYTHON_COLORS': '0'}, True, ignore_environment)
6875

6976
@unittest.skipUnless(sys.platform == "win32", "requires Windows")
7077
def test_colorized_detection_checks_on_windows(self):

0 commit comments

Comments
 (0)
0