From cd36afe9e4f194a832c122aa7de835b8a0878fcd Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 10 Oct 2021 18:15:27 +0200 Subject: [generate_card.py] assert against useless use of lists --- scripts/generate_card.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/generate_card.py b/scripts/generate_card.py index adee5693..8e8f0aa6 100755 --- a/scripts/generate_card.py +++ b/scripts/generate_card.py @@ -114,6 +114,7 @@ def get_latex_field(card: MutableMapping, # Transform a list of values into a single string. # normal fields are joined using '\\ ' if not has_latex: + assert len(normal_value) > 1 return '\\\\ '.join(normal_value), False # latex_* values are just concatenated. @@ -121,6 +122,7 @@ def get_latex_field(card: MutableMapping, # NOTE: it is allowed for a latex_ field to be sparse. # Missing entries in a latex_ field list are populated from the corrsponding # entry of the normal field + assert len(latex_value) > 1 for i in range(0, len(latex_value)): if latex_value[i] is None: latex_value[i] = f'{fmt_prefix}{normal_value[i]}// ' -- cgit v1.2.3