mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2025-02-17 05:18:31 +00:00
One more assertion. Extra pokemon loading improvements
This commit is contained in:
parent
710428229a
commit
a33a9ba817
2 changed files with 7 additions and 5 deletions
11
database.py
11
database.py
|
@ -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(),
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue