示例#1
0
def test_match(name, pref_names):
    """ Check that a player can match to another player correctly. """

    player = Player(name)
    other = Player(pref_names[0])

    player.match(other)
    assert player.matching == other
示例#2
0
def test_check_if_match_unacceptable(name, pref_names):
    """ Test that the acceptability of a match is caught correctly. """

    player = Player(name)
    others = [Player(other) for other in pref_names]

    message = player.unmatched_message()
    assert player.check_if_match_is_unacceptable() == message

    player.set_prefs(others[:-1])
    player.match(others[-1])
    message = player.not_in_preferences_message(others[-1])
    assert player.check_if_match_is_unacceptable() == message

    player.set_prefs(others)
    assert player.check_if_match_is_unacceptable() is None