Skip to content

Commit f13d824

Browse files
Update ellens-alien-game test to prevent returning an empty list from the factory
Before this change, you can pass the tests for `new_aliens_collection` by returning an empty list. After this change, the returned list must have the same length as the input list (so you create the same number of Aliens as the input asks for).
1 parent 61dbb3a commit f13d824

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

exercises/concept/ellens-alien-game/classes_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ def test_new_aliens_collection(self):
199199
test_data = [(-2, 6), (1, 5), (-4, -3)]
200200
actual_result = new_aliens_collection(test_data)
201201

202+
length_error_message = f"Expected {len(test_data)} Aliens, got {len(actual_result)}"
203+
self.assertEqual(len(actual_result), len(test_data), msg=length_error_message)
204+
202205
error_message = "new_aliens_collection() must return a list of Alien objects."
203206

204207
for obj in actual_result:

0 commit comments

Comments
 (0)