Return an empty object if an archive does not have the requested style
This commit is contained in:
parent
df781f67e3
commit
c3a8221d99
@ -167,8 +167,10 @@ class ComicArchive:
|
||||
def read_metadata(self, style: str) -> GenericMetadata:
|
||||
if style in self.md:
|
||||
return self.md[style]
|
||||
md = metadata_styles[style].get_metadata(self.archiver)
|
||||
md.apply_default_page_list(self.get_page_name_list())
|
||||
md = GenericMetadata()
|
||||
if metadata_styles[style].has_metadata(self.archiver):
|
||||
md = metadata_styles[style].get_metadata(self.archiver)
|
||||
md.apply_default_page_list(self.get_page_name_list())
|
||||
return md
|
||||
|
||||
def read_metadata_string(self, style: str) -> str:
|
||||
|
@ -85,9 +85,8 @@ def test_delete(
|
||||
# Read the CBZ
|
||||
md = tmp_comic.read_metadata("cr")
|
||||
|
||||
# Currently we set the default page list on load
|
||||
# The default page list is set on load if the comic has the requested metadata style
|
||||
empty_md = comicapi.genericmetadata.GenericMetadata()
|
||||
empty_md.apply_default_page_list(tmp_comic.get_page_name_list())
|
||||
|
||||
# Validate that we got an empty metadata back
|
||||
assert md == empty_md
|
||||
|
Loading…
Reference in New Issue
Block a user