Exemplo n.º 1
0
    def test_get_tournament(self):

        # These tests work because a TournamentData has a similar structure to a Tournament
        # When Tournament.__eq__ is called, it compares the fields without caring of the parameters' actual types

        self.assertEquals(Tournament.get_tournament(1, 1), TournamentData.tournament_11)
        self.assertEquals(Tournament.get_tournament(1, 2), TournamentData.tournament_12)
        self.assertEquals(Tournament.get_tournament(1, 3), None)
        self.assertEquals(Tournament.get_tournament(1, 4), None)

        self.assertEquals(Tournament.get_tournament(2, 1), TournamentData.tournament_21)
        self.assertEquals(Tournament.get_tournament(2, 2), None)
        self.assertEquals(Tournament.get_tournament(2, 3), None)

        self.assertEquals(Tournament.get_tournament(42, 1), None)
        self.assertEquals(Tournament.get_tournament(42, 9), None)
Exemplo n.º 2
0
    def test_get_tournament(self):

        # These tests work because a TournamentData has a similar structure to a Tournament
        # When Tournament.__eq__ is called, it compares the fields without caring of the parameters' actual types

        self.assertEquals(Tournament.get_tournament(1, 1),
                          TournamentData.tournament_11)
        self.assertEquals(Tournament.get_tournament(1, 2),
                          TournamentData.tournament_12)
        self.assertEquals(Tournament.get_tournament(1, 3), None)
        self.assertEquals(Tournament.get_tournament(1, 4), None)

        self.assertEquals(Tournament.get_tournament(2, 1),
                          TournamentData.tournament_21)
        self.assertEquals(Tournament.get_tournament(2, 2), None)
        self.assertEquals(Tournament.get_tournament(2, 3), None)

        self.assertEquals(Tournament.get_tournament(42, 1), None)
        self.assertEquals(Tournament.get_tournament(42, 9), None)
Exemplo n.º 3
0
    def GET(self, season_id, position):
        
        tournament = Tournament.get_tournament(int(season_id), int(position))

        if tournament is None:
            raise web.notfound()

        return config.views.layout(
            config.views.tournament(
                tournament,
                config.views.statistics(tournament),
                config.views.results(tournament),
                config.views.comments(tournament, config.views.comment)
            )
        )