def test_league_ranker_simple(): team_scores = { 'ABC': TeamScore(), 'DEF': TeamScore(4, 5) } ranking = LeagueScores.rank_league(team_scores) expected_map = { 'DEF': 1, 'ABC': 2, } expected_order = ['DEF', 'ABC'] assert expected_map == ranking order = ranking.keys() assert expected_order == order
def test_league_ranker_full_tie(): team_scores = { 'ABC': TeamScore(4, 5), 'DEF': TeamScore(4, 5), 'GHI': TeamScore(), } ranking = LeagueScores.rank_league(team_scores) expected_map = { 'DEF': 1, 'ABC': 1, 'GHI': 3, } expected_order = ['ABC', 'DEF', 'GHI'] assert expected_map == ranking order = ranking.keys() assert expected_order == order