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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user