def test_client_get_puzzle_leaderboard_error(client: SyncClient): with pytest.raises(ValueError): client.get_puzzle_leaderboard("codingame-optim", group="nonexistent") with pytest.raises(exceptions.LoginRequired): client.get_puzzle_leaderboard("codingame-optim", group="country") with pytest.raises(exceptions.PuzzleNotFound): client.get_puzzle_leaderboard("nonexistent")
def test_client_get_puzzle_leaderboard(client: SyncClient, puzzle_id: str): puzzle_leaderboard = client.get_puzzle_leaderboard(puzzle_id) assert isinstance(puzzle_leaderboard, PuzzleLeaderboard) assert isinstance(puzzle_leaderboard.users[0], PuzzleRankedCodinGamer) if puzzle_leaderboard.has_leagues: assert isinstance(puzzle_leaderboard.leagues[0], League) # test League.__eq__ assert puzzle_leaderboard.leagues[0] == League( client._state, { "divisionCount": 6, "divisionIndex": 0, "divisionAgentsCount": 100, }, )