Exemple #1
0
def test_unmatch(name, capacity, pref_names):
    """Check that a project can break a matching with a student, and break that
    matching for their supervisor member, too."""

    project = Project(name, capacity)
    supervisor = Supervisor("foo", capacity)
    project.supervisor = supervisor
    students = [Student(student) for student in pref_names]

    project.matching = students
    supervisor.matching = students
    for i, student in enumerate(students[:-1]):
        project._unmatch(student)
        assert project.matching == students[i + 1:]
        assert supervisor.matching == students[i + 1:]

    project._unmatch(students[-1])
    assert project.matching == []
    assert supervisor.matching == []
Exemple #2
0
def test_match(name, capacity, pref_names):
    """Check that a project can match to a student, and match its supervisor to
    them, too."""

    project = Project(name, capacity)
    supervisor = Supervisor("foo", capacity)
    project.supervisor = supervisor
    students = [Student(student) for student in pref_names]

    project.prefs = students
    supervisor.prefs = students
    for i, student in enumerate(students[:-1]):
        project._match(student)
        assert project.matching == students[:i + 1]
        assert supervisor.matching == students[:i + 1]

    project._match(students[-1])
    assert project.matching == students
    assert supervisor.matching == students