jrnl/tests/test_export.py
Suhas 2d4ba1bf2f enforce positive initial linewrap
Check column widths

update gitignore

throw error when linewrap too small

simply check for large enough linewrap value
2021-03-21 18:05:14 -04:00

39 lines
830 B
Python

from jrnl.exception import JrnlError
from jrnl.plugins.fancy_exporter import FancyExporter
import pytest
@pytest.fixture()
def datestr():
yield "2020-10-20 16:59"
from textwrap import TextWrapper
def provide_date_wrapper(initial_linewrap):
wrapper = TextWrapper(
width=initial_linewrap, initial_indent=" ", subsequent_indent=" "
)
return wrapper
def build_card_header(datestr):
top_left_corner = "┎─╮"
content = top_left_corner + datestr
return content
class TestFancy:
def test_too_small_linewrap(self, datestr):
content = build_card_header(datestr)
total_linewrap = 12
with pytest.raises(JrnlError) as e:
FancyExporter.check_linewrap(total_linewrap, [content])
assert e.value.error_type == "LineWrapTooSmallForDateFormat"