From c5a5fc8bdb160ccdfdf2472dc911a43de2b0e54c Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Thu, 24 Nov 2022 01:24:15 -0800 Subject: [PATCH] Fix issue with combine_notes --- comicapi/utils.py | 4 ++-- tests/utils_test.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/comicapi/utils.py b/comicapi/utils.py index 8243f3d..42cf19f 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -38,8 +38,8 @@ class UtilsVars: def combine_notes(existing_notes: str | None, new_notes: str | None, split: str) -> str: - split_notes, _, untouched_notes = (existing_notes or "").rpartition(split) - if split_notes: + split_notes, split_str, untouched_notes = (existing_notes or "").rpartition(split) + if split_notes or split_str: return (split_notes + (new_notes or "")).strip() else: return (untouched_notes + "\n" + (new_notes or "")).strip() diff --git a/tests/utils_test.py b/tests/utils_test.py index 6d66b28..ba525ee 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -86,6 +86,7 @@ combine_values = [ (None, "english", "en", "english"), ("hello", "", "en", "hello"), ("hello", None, "en", "hello"), + ("hello", "hello", "hel", "hello"), ]