mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-19 20:48:31 +02:00
basic colorize unittest
This commit is contained in:
parent
bfb975b1bb
commit
1739cee1f0
1 changed files with 24 additions and 0 deletions
24
tests/test_color.py
Normal file
24
tests/test_color.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import colorama
|
||||
import pytest
|
||||
|
||||
from jrnl.color import colorize
|
||||
from colorama import Fore, Style
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def data_fixture():
|
||||
string = "Zwei peanuts walked into a bar"
|
||||
yield string
|
||||
|
||||
|
||||
def test_colorize(data_fixture):
|
||||
string = data_fixture
|
||||
colorized_string = colorize(string, "BLUE", True)
|
||||
|
||||
assert colorized_string == Style.BRIGHT + Fore.BLUE + string + Style.RESET_ALL
|
||||
|
||||
|
||||
def test_colorize_none(data_fixture):
|
||||
string = data_fixture
|
||||
colorized_string = colorize(string, None, False)
|
||||
assert colorized_string == string
|
Loading…
Add table
Reference in a new issue