summaryrefslogtreecommitdiffstats
path: root/tests/test_toggles.py
blob: a2a6cdad81f0a91d486bff97c785eb38ff34691d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()