1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[tests] use extended format strings for archive ID tests

This commit is contained in:
Mike Fährmann 2024-10-10 19:32:09 +02:00
parent 0f7d032773
commit 29e46f6875
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -210,6 +210,7 @@ class TestExtractorResults(unittest.TestCase):
if "#urls" in result:
expected = result["#urls"]
if isinstance(expected, str):
self.assertTrue(tjob.url_list, msg="#urls")
self.assertEqual(tjob.url_list[0], expected, msg="#urls")
else:
self.assertSequenceEqual(tjob.url_list, expected, msg="#urls")
@ -288,6 +289,8 @@ class ResultJob(job.DownloadJob):
"".join(self.extractor.directory_fmt)).format_map
self.format_filename = TestFormatter(
self.extractor.filename_fmt).format_map
self.format_archive = TestFormatter(
self.extractor.archive_fmt).format_map
def run(self):
self._init()
@ -325,7 +328,7 @@ class ResultJob(job.DownloadJob):
json.dumps(kwdict, sort_keys=True, default=str).encode())
def _update_archive(self, kwdict):
archive_id = self.extractor.archive_fmt.format_map(kwdict)
archive_id = self.format_archive(kwdict)
self.archive_list.append(archive_id)
self.archive_hash.update(archive_id.encode())