mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-19 04:28:31 +02:00
Check column widths update gitignore throw error when linewrap too small simply check for large enough linewrap value
39 lines
830 B
Python
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"
|