diff options
author | Mattori Birnbaum <mattori.birnbaum@gmail.com> | 2021-05-08 20:39:43 +0900 |
---|---|---|
committer | Christian Geier <geier@lostpackets.de> | 2023-10-28 16:40:56 +0200 |
commit | 5e889211c2adc9226e000f093e7324bb7e749b14 (patch) | |
tree | fe2bb983bff67d89a0a154f0f4c7fe2d3155ce11 | |
parent | a9c0fde086720eecb7308f7f4ebddbffea25ba2b (diff) |
added test for human_formatter width
-rw-r--r-- | tests/utils_test.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/utils_test.py b/tests/utils_test.py index d19f3bed..d9f09bf3 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -1,6 +1,7 @@ """testing functions from the khal.utils""" import datetime as dt +from click import style from freezegun import freeze_time from khal import utils @@ -119,3 +120,9 @@ def test_get_weekday_occurrence(): assert utils.get_weekday_occurrence(dt.date(2017, 5, 8)) == (0, 2) assert utils.get_weekday_occurrence(dt.date(2017, 5, 28)) == (6, 4) assert utils.get_weekday_occurrence(dt.date(2017, 5, 29)) == (0, 5) + + +def test_human_formatter_width(): + formatter = utils.human_formatter('{red}{title}', width=10) + output = formatter({'title': 'morethan10characters', 'red': style('', reset=False, fg='red')}) + assert output.startswith('\x1b[31mmoret\x1b[0m') |