From 1ccee475c3f9142d8cc2dd91f17e9ba083170f3c Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 22 Nov 2023 12:43:28 -0800 Subject: [PATCH] better error --- src/ytdl_sub/script/parser.py | 4 +--- tests/unit/script/test_parser.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ytdl_sub/script/parser.py b/src/ytdl_sub/script/parser.py index db1a040b..f53dde82 100644 --- a/src/ytdl_sub/script/parser.py +++ b/src/ytdl_sub/script/parser.py @@ -467,9 +467,7 @@ class _Parser: self._pos += 1 if ch1 is None: - raise StringFormattingException( - "Open bracket at the end was not properly closed" - ) + break # will hit closing bracket error if ch1 == "%": self._pos += 1 diff --git a/tests/unit/script/test_parser.py b/tests/unit/script/test_parser.py index c248d85e..4f518939 100644 --- a/tests/unit/script/test_parser.py +++ b/tests/unit/script/test_parser.py @@ -174,7 +174,7 @@ class TestParser: class TestParserBracketFailures: def test_bracket_open(self): - with pytest.raises(StringFormattingException): + with pytest.raises(InvalidSyntaxException, match=re.escape(str(BRACKET_NOT_CLOSED))): parse("{") def test_bracket_close(self):