From 896739353a613f23c007d9acaa2809010a522a37 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 16 Sep 2022 11:10:14 +0200 Subject: Adding upstream version 2.2.0. Signed-off-by: Daniel Baumann --- tests/test_toggles.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_toggles.py (limited to 'tests/test_toggles.py') diff --git a/tests/test_toggles.py b/tests/test_toggles.py new file mode 100644 index 0000000..a2a6cda --- /dev/null +++ b/tests/test_toggles.py @@ -0,0 +1,29 @@ +"""Test objects in module.""" + +from colorclass import toggles + + +def test_disable(): + """Test functions.""" + toggles.disable_all_colors() + assert not toggles.is_enabled() + toggles.enable_all_colors() + assert toggles.is_enabled() + toggles.disable_all_colors() + assert not toggles.is_enabled() + toggles.enable_all_colors() + assert toggles.is_enabled() + assert toggles.disable_if_no_tty() # pytest pipes stderr/stdout. + assert not toggles.is_enabled() + + +def test_light_bg(): + """Test functions.""" + toggles.set_dark_background() + assert not toggles.is_light() + toggles.set_light_background() + assert toggles.is_enabled() + toggles.set_dark_background() + assert not toggles.is_light() + toggles.set_light_background() + assert toggles.is_enabled() -- cgit v1.2.3