Add an assertion for summarize_items (#1232)

This commit is contained in:
Adrian Sampson 2015-01-17 14:20:53 -08:00
parent bf02855ee1
commit 6f2d9845b5
2 changed files with 2 additions and 5 deletions

View file

@ -464,9 +464,6 @@ class ImportTask(object):
"""
if self.choice_flag == action.ASIS:
return list(self.items)
# FIXME this should be a simple attribute. There should be no
# need to retrieve the keys of `match.mapping`. This requires
# that we remove unmatched items from the list.
elif self.choice_flag == action.APPLY:
return self.match.mapping.keys()
else:
@ -475,8 +472,6 @@ class ImportTask(object):
def apply_metadata(self):
"""Copy metadata from match info to the items.
"""
# TODO call should be more descriptive like
# apply_metadata(self.match, self.items)
autotag.apply_metadata(self.match.info, self.match.mapping)
def duplicate_items(self, lib):

View file

@ -419,6 +419,8 @@ def summarize_items(items, singleton):
this is an album or single-item import (if the latter, them `items`
should only have one element).
"""
assert items, "summarizing zero items"
summary_parts = []
if not singleton:
summary_parts.append("{0} items".format(len(items)))