more tests

This commit is contained in:
Jesse Bannon 2023-06-17 12:48:46 -07:00
parent 1c4ddbd5a0
commit f307fa6196
3 changed files with 7 additions and 4 deletions

View file

@ -1,8 +1,6 @@
import re import re
import pytest import pytest
from expected_download import assert_expected_downloads
from expected_transaction_log import assert_transaction_log_matches
from ytdl_sub.subscriptions.subscription import Subscription from ytdl_sub.subscriptions.subscription import Subscription
from ytdl_sub.utils.exceptions import ValidationException from ytdl_sub.utils.exceptions import ValidationException

View file

@ -349,7 +349,9 @@ class TestRegex:
) )
with pytest.raises( with pytest.raises(
ValidationException, ValidationException,
match=re.escape("cannot regex capture 'dne' because it is not a source variable"), match=re.escape(
"cannot regex capture 'dne' because it is not a source or override variable"
),
): ):
_ = Subscription.from_dict( _ = Subscription.from_dict(
config=music_video_config, config=music_video_config,

View file

@ -32,7 +32,9 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict
{ {
"regex": { "regex": {
"from": { "from": {
"chapter_title": { # Ensure regex can handle override variables that come from the
# post-metadata stage
"override_chapter_title": {
"match": r"\d+\. (.+)", "match": r"\d+\. (.+)",
"capture_group_names": "captured_track_title", "capture_group_names": "captured_track_title",
"capture_group_defaults": "{chapter_title}", "capture_group_defaults": "{chapter_title}",
@ -54,6 +56,7 @@ def yt_album_as_chapters_with_regex_preset_dict(yt_album_as_chapters_preset_dict
} }
}, },
"overrides": { "overrides": {
"override_chapter_title": "{chapter_title}",
"track_title": "{captured_track_title}", "track_title": "{captured_track_title}",
"track_album": "{captured_track_album}", "track_album": "{captured_track_album}",
"track_artist": "{captured_track_artist}", "track_artist": "{captured_track_artist}",