1def is_everyone_comfy(students_in_car):
2 """Given a car and its current occupants, check if all occupants are comfy."""
3 return all(student.is_comfy() for student in students_in_car)
4
5def organize(cars, students):
6 """Accommodate all students in the available cars, ensuring everyone is comfy, if possible."""
7 for student in students:
8 is_accommodated = False
9 for car in cars:
10 try:
11 car.add_student(student)
12 if is_everyone_comfy(car.students):
13 is_accommodated = True
14 break
15 else:
16 car.remove_student(student)
17 except EnvironmentError:
18 continue
19 if not is_accommodated:
20 return False
21 return True
...F.
======================================================================
FAIL: test_regular_case (test.TesFull)
Test a regular case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 47, in test_regular_case
anti_rusalov_true(self, organize(cars, students))
AssertionError: False is not true
----------------------------------------------------------------------
Ran 5 tests in 0.000s
FAILED (failures=1)