PR feedback

make exception more informative

update check_linewrap signature in src and test

make check_linewrap a free function
This commit is contained in:
Suhas 2021-04-10 09:59:59 -04:00
parent e063fa9715
commit 502d47f223
4 changed files with 22 additions and 16 deletions

View file

@ -1,6 +1,5 @@
from jrnl.exception import JrnlError
from jrnl.plugins.fancy_exporter import FancyExporter
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
import pytest
@ -30,10 +29,11 @@ def build_card_header(datestr):
class TestFancy:
def test_too_small_linewrap(self, datestr):
journal = "test_journal"
content = build_card_header(datestr)
total_linewrap = 12
with pytest.raises(JrnlError) as e:
FancyExporter.check_linewrap(total_linewrap, [content])
check_provided_linewrap_viability(total_linewrap, [content], journal)
assert e.value.error_type == "LineWrapTooSmallForDateFormat"