def test(self): cnx = mysql.connector.connect(user="******", host="127.0.0.1", database="mlb", password="") cursor = cnx.cursor() today = "2018-07-02" optimize = MlbOptimizer.MlbOptimizer(today, cursor) roto = rws.RotoScraper("") with open("tests/rotoMock.txt") as src: page = src.read() roto.soup = BeautifulSoup(page, 'html.parser') gameTimes, startTimes = roto.get_game_times() teams = [] for team in gameTimes: teams.append(team) slate = WsaEngine.Slate(teams, "All") optimize.generateLineups("rotowire", 2, today, "00:00:01", slate) self.assertEqual(optimize.my_lineups[1].points, 138.37)
def test(self): roto = rws.RotoScraper("") with open("tests/rotoMock.txt") as src: page = src.read() roto.soup = BeautifulSoup(page, 'html.parser') gameTimes, startTimes = roto.get_game_times() self.assertTrue("13:07:00" in startTimes)
def test(self): roto = rws.RotoScraper("") with open("tests/rotoMock.txt") as src: page = src.read() roto.soup = BeautifulSoup(page, 'html.parser') players = roto.get_players() namedPlayers = [] bryce = [] for player in players: namedPlayers.append(player.name) if player.name == "Bryce Harper": bryce = player self.assertTrue("Daniel Murphy" in namedPlayers) self.assertTrue("Bryce Harper" in namedPlayers) self.assertEqual(bryce.sal, "4400")
def test(self): roto = rgs.RotoGuruScraper("") with open("tests/rotoGuruMockPitchers.txt") as src: page = src.read() roto.soup = BeautifulSoup(page, 'html.parser') # this depends on other rotogure test working players = roto.get_players() today = "2018-07-02" cnx = mysql.connector.connect(user="******", host="127.0.0.1", database="mlb", password="") cursor = cnx.cursor() for player in players: player.insertTable(cursor, today) roto = rws.RotoScraper("") with open("tests/rotoMock.txt") as src: page = src.read() roto.soup = BeautifulSoup(page, 'html.parser') players = roto.get_players() for player in players: player.insertTable(cursor, today) cnx.commit() cursor.execute( "select RotoGrindersProjection, RotoWireProjection from players where Name=\"Madison Bumgarner\";" ) grinder, wire = cursor.fetchall()[0] self.assertEqual(grinder, 28.26) self.assertEqual(wire, 39.66)
def test(self): url = "https://www.rotowire.com/daily/mlb/optimizer.php?site=FanDuel&sport=mlb" roto = rws.RotoScraper(url) roto.get_soup() self.assertTrue(roto.soup is not None)