summaryrefslogtreecommitdiffstats
path: root/tests/test_toggles.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_toggles.py')
-rw-r--r--tests/test_toggles.py29
1 files changed, 29 insertions, 0 deletions
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()