@@ -0,0 +1,1417 @@
+import roundrobin%0Aimport unittest%0A%0Aclass TestRoundRobin(unittest.TestCase):%0A    def testRotate(self):%0A        robin = roundrobin.RoundRobin(6)%0A        self.assertEqual( robin.teams, %5B%22A%22, %22B%22, %22C%22, %22D%22, %22E%22, %22F%22%5D )%0A        robin.rotate()%0A        self.assertEqual( robin.teams, %5B%22A%22, %22F%22, %22B%22, %22C%22, %22D%22, %22E%22%5D )%0A        robin.rotate()%0A        self.assertEqual( robin.teams, %5B%22A%22, %22E%22, %22F%22, %22B%22, %22C%22, %22D%22%5D )%0A    %0A    def testGetRound(self):%0A        robin = roundrobin.RoundRobin(6)%0A        games = robin.getRound()%0A        self.assertEqual( str(games%5B0%5D), %22A vs B%22)%0A        self.assertEqual( str(games%5B1%5D), %22C vs D%22)%0A        self.assertEqual( str(games%5B2%5D), %22E vs F%22)%0A    %0A    def testGetSchedule(self):%0A        teams_count = 4%0A        rounds_count = 2 * (teams_count-1)%0A        robin = roundrobin.RoundRobin(teams_count)%0A        schedule = robin.getSchedule(rounds_count)%0A        self.assertEqual( len(schedule), rounds_count)%0A        home = %7B%7D%0A        away = %7B%7D%0A        for day in schedule:%0A            self.assertEqual( len(day), teams_count/2)%0A            for game in day:%0A                home%5Bgame.team_home%5D = home.get(game.team_home, 0) + 1%0A                away%5Bgame.team_away%5D = away.get(game.team_away, 0) + 1%0A        self.assertEqual( home.values(), %5Brounds_count/2%5D*teams_count )%0A        self.assertEqual( away.values(), %5Brounds_count/2%5D*teams_count )%0A        %0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

Create roundrobin_test.py