Added {strip} template

This commit is contained in:
Rhet Turnbull
2021-08-28 08:14:26 -07:00
parent dbb4dbc0a7
commit 159d1102aa
4 changed files with 23 additions and 3 deletions

View File

@@ -394,12 +394,18 @@ UUID_ALBUM_SEQ = {
}
UUID_EMPTY_TITLE = "7783E8E6-9CAC-40F3-BE22-81FB7051C266" # IMG_3092.heic
UUID_EMPTY_TITLE_HAS_DESCRIPTION = "E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51" # wedding.jpg
TEMPLATE_VALUES_EMPTY_TITLE = {
"{title,No Title} and {descr,No Descr}": "No Title and No Descr",
"{title?true,false}": "false",
}
TEMPLATE_VALUES_EMPTY_TITLE_HAS_DESCRIPTION = {
"{title,} {descr} ": " Bride Wedding day ",
"{strip,{title,} {descr} }": "Bride Wedding day",
}
@pytest.fixture(scope="module")
def photosdb_places():
@@ -1194,3 +1200,11 @@ def test_empty_title(photosdb):
for template, value in TEMPLATE_VALUES_EMPTY_TITLE.items():
rendered, _ = photo.render_template(template)
assert value in "".join(rendered)
def test_strip(photosdb):
"""Test {strip} template"""
photo = photosdb.get_photo(UUID_EMPTY_TITLE_HAS_DESCRIPTION)
for template, value in TEMPLATE_VALUES_EMPTY_TITLE_HAS_DESCRIPTION.items():
rendered, _ = photo.render_template(template)
assert value in "".join(rendered)