Error Message and Instructions for Ellens Alien Game (Issue 2992) (#3058)

Fenced the import of new_aliens_collection() function to throw custom error.
Changed instructions to clarify that new_aliens_collection() is meant to be *outside* the Alien() class.
Changed stub file to add a TODO around creating new_aliens_collection() explicitly outsied the Alien() class.
This commit is contained in:
BethanyG
2022-05-21 11:30:52 -07:00
committed by GitHub
parent 13be189550
commit dd4adabb51
3 changed files with 13 additions and 4 deletions

View File

@@ -1,12 +1,17 @@
import unittest
import pytest
from classes import new_aliens_collection
try:
from classes import new_aliens_collection
except ImportError as err:
raise ImportError("We tried to import the new_aliens_collection() function, "
"but could not find it. Did you remember to create it?") from err
try:
from classes import Alien
except ImportError as err:
raise ImportError("We tried to import the 'Alien' class, but could not find it. "
raise ImportError("We tried to import the 'Alien' class from the classes.py file, but could not find it. "
"Did you remember to create it?") from err