1def organize(cars, students):
2 newer_students = students.copy()
3 ctr = len(students)
4 for car in cars:
5 new_students = newer_students
6 for student in new_students.copy():
7 try:
8 car.add_student(student)
9 except EnvironmentError:
10 break
11 else:
12 if student.is_comfy():
13 newer_students.remove(student)
14 ctr -= 1
15 continue
16 else:
17 car.remove_student(student)
18 counter = 0
19 for car in cars:
20 if len(car.students) == car.CAPACITY:
21 counter +=1
22 if counter == len(cars) or ctr == 0:
23 return True
24 return False
.F.F.
======================================================================
FAIL: test_empty (test.TesFull)
Test with empty cars.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 27, in test_empty
anti_rusalov_false(self, organize([], students))
AssertionError: True is not false
======================================================================
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.001s
FAILED (failures=2)