diff --git a/Lib/test/test__colorize.py b/Lib/test/test__colorize.py index ff15d83cb078fe..1959773c4967cd 100644 --- a/Lib/test/test__colorize.py +++ b/Lib/test/test__colorize.py @@ -44,11 +44,16 @@ def check(env, fallback, expected): check({'TERM': ''}, fallback, fallback) check({'FORCE_COLOR': '1'}, fallback, True) check({'FORCE_COLOR': '0'}, fallback, True) + check({'FORCE_COLOR': ''}, fallback, fallback) check({'NO_COLOR': '1'}, fallback, False) check({'NO_COLOR': '0'}, fallback, False) + check({'NO_COLOR': ''}, fallback, fallback) check({'TERM': 'dumb', 'FORCE_COLOR': '1'}, False, True) check({'FORCE_COLOR': '1', 'NO_COLOR': '1'}, True, False) + check({'FORCE_COLOR': '1', 'NO_COLOR': ''}, True, True) + check({'FORCE_COLOR': '', 'NO_COLOR': '1'}, True, False) + check({'FORCE_COLOR': '', 'NO_COLOR': ''}, True, True) for ignore_environment in False, True: # Simulate running with or without `-E`. @@ -64,7 +69,9 @@ def check(env, fallback, expected): check({'TERM': 'dumb', 'PYTHON_COLORS': '1'}, False, not ignore_environment) check({'NO_COLOR': '1', 'PYTHON_COLORS': '1'}, False, not ignore_environment) + check({'NO_COLOR': '', 'PYTHON_COLORS': '1'}, False, not ignore_environment) check({'FORCE_COLOR': '1', 'PYTHON_COLORS': '0'}, True, ignore_environment) + check({'FORCE_COLOR': '', 'PYTHON_COLORS': '0'}, True, ignore_environment) @unittest.skipUnless(sys.platform == "win32", "requires Windows") def test_colorized_detection_checks_on_windows(self):