Merge pull request #384 from danschwarz/constants

Added sanity check tests to ensure PALETTE and MONO_PALETTE match
This commit is contained in:
Ivan Habunek 2023-07-08 08:45:49 +02:00 committed by GitHub
commit 4f62f417f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

15
tests/test_constants.py Normal file
View File

@ -0,0 +1,15 @@
from toot.tui.constants import PALETTE, MONO_PALETTE
def test_palette():
# for every entry in PALETTE, there must be
# a corresponding entry in MONO_PALETTE
for pal in PALETTE:
matches = [item for item in MONO_PALETTE if item[0] == pal[0]]
assert len(matches) > 0, f"{pal}, present in PALETTE, missing from MONO_PALETTE"
# for every entry in MONO_PALETTE, there must be
# a corresponding entry in PALETTE
for pal in MONO_PALETTE:
matches = [item for item in PALETTE if item[0] == pal[0]]
assert len(matches) > 0, f"{pal}, present in MONO_PALETTE, missing from PALETTE"

View File

@ -75,7 +75,6 @@ MONO_PALETTE = [
('warning', 'white,bold', 'black'),
# Functional
('account', 'dark green', ''),
('hashtag_followed', 'white,bold', ''),
('hashtag', 'white,bold', ''),
('link', ',italics', ''),