One more assertion. Extra pokemon loading improvements

This commit is contained in:
Samuel Henrique 2017-07-03 18:10:11 -03:00
parent 710428229a
commit a33a9ba817
2 changed files with 7 additions and 5 deletions

View file

@ -230,11 +230,12 @@ class Database:
def __load_extra(self):
"""Load all the file names of the images in the Extra folder."""
for file in os.listdir(self.directory + "/Images/Extra"):
if file.endswith(".jpg"):
name = os.path.join("/Images/Extra", file)\
.split('/')[-1][0:-4].lower()
path = self.directory + "/Images/Extra/" + name + ".jpg"
extra_dir = os.path.join(self.directory, "Images", "Extra")
for file in os.listdir(extra_dir):
name, ext = os.path.splitext(file.lower())
if ext == '.jpg':
path = os.path.join(self.directory, 'Images', 'Extra',
name + ext)
father = self.__pokemon_dictionary.get(name.split("-")[0])
if father is not None:
pokemon = Pokemon(None, name, father.get_region(),

View file

@ -22,6 +22,7 @@ def test_no_args(capsys):
def test_len():
# Database unfortunately makes db.__MAX_ID private :-(
__MAX_ID = 493
assert len(db) == __MAX_ID + len(db.get_extra())
assert len(db.get_all()) == __MAX_ID + len(db.get_extra())