add(schema): {Narrators} placeholder, {Narrator} now names the first speaker
This commit is contained in:
@@ -59,3 +59,26 @@ def test_missing_values_do_not_leave_dangling_separators():
|
||||
series="Tony Ballard", volume=1, year=2020, narrator="")
|
||||
assert render_template("{Series}/{Volume} - {Title}", numbered) == \
|
||||
"Tony Ballard/01 - Die Höllenbrut"
|
||||
|
||||
|
||||
def test_narrator_uses_the_first_name_only():
|
||||
"""Two editions of one book differ by narrator; a full cast must not blow up
|
||||
the folder name."""
|
||||
fry = SimpleNamespace(title="Philosopher's Stone", authors="J.K. Rowling",
|
||||
series="Harry Potter", volume=1, year=None,
|
||||
narrator="Stephen Fry")
|
||||
cast = SimpleNamespace(title="Philosopher's Stone", authors="J.K. Rowling",
|
||||
series="Harry Potter", volume=1, year=None,
|
||||
narrator="Hugh Laurie, Matthew Macfadyen, Riz Ahmed, Michelle Gomez")
|
||||
template = "{Series}/{Volume} - {Title} ({Narrator})"
|
||||
assert render_template(template, fry) == "Harry Potter/01 - Philosopher's Stone (Stephen Fry)"
|
||||
assert render_template(template, cast) == "Harry Potter/01 - Philosopher's Stone (Hugh Laurie)"
|
||||
# the full list stays available
|
||||
assert render_template("{Narrators}", cast) == \
|
||||
"Hugh Laurie, Matthew Macfadyen, Riz Ahmed, Michelle Gomez"
|
||||
|
||||
|
||||
def test_narrator_missing_leaves_no_empty_brackets():
|
||||
req = SimpleNamespace(title="Ein Buch", authors="Jemand", series="", volume=None,
|
||||
year=None, narrator="")
|
||||
assert render_template("{Series}/{Volume} - {Title} ({Narrator})", req) == "Ein Buch"
|
||||
|
||||
Reference in New Issue
Block a user