Beispiel #1
0
def test_ids_for_year(sc):
    gm = game.Game(sc, 'mlb')
    gm.inject_yhandler(mock_yhandler.YHandler())
    ids = gm.league_ids(year=2017)
    assert (len(ids) == 1)
    print(ids)
    assert (ids[0] == '370.l.56877')
Beispiel #2
0
def test_ids(sc):
    gm = game.Game(sc, 'mlb')
    gm.inject_yhandler(mock_yhandler.YHandler())
    ids = gm.league_ids()
    for i in ids:
        print(i)
    assert (len(ids) == 12)
    print(ids)
    assert (ids[5] == '268.l.46645')
def test_roster(sc):
    tm = yfa.Team(sc, '268.l.46645')
    tm.inject_yhandler(mock_yhandler.YHandler())
    r = tm.roster(3)
    print(r)
    assert (len(r) == 25)
    print(r[21])
    assert (r[21]['name'] == 'Brandon Woodruff')
    assert (r[21]['position_type'] == 'P')
    assert (r[21]['player_id'] == 10730)
    assert (r[21]['selected_position'] == 'BN')
    print(r[5])
    assert (r[5]['name'] == 'Juan Soto')
    assert (r[5]['position_type'] == 'B')
    assert (len(r[5]['eligible_positions']) == 2)
    assert (r[5]['eligible_positions'][0] == 'LF')
    assert (r[5]['eligible_positions'][1] == 'Util')
    assert (r[5]['selected_position'] == 'LF')
Beispiel #4
0
def mock_league(sc):
    lg = league.League(sc, '370.l.56877')
    lg.inject_yhandler(mock_yhandler.YHandler())
    yield lg
def test_matchup(sc):
    tm = yfa.Team(sc, '268.l.46645')
    tm.inject_yhandler(mock_yhandler.YHandler())
    opponent = tm.matchup(3)
    assert (opponent == '388.l.27081.t.5')
Beispiel #6
0
def test_to_league(sc):
    gm = game.Game(sc, 'mlb')
    gm.inject_yhandler(mock_yhandler.YHandler())
    lg = gm.to_league('370.l.56877')
    assert (type(lg) is league.League)
Beispiel #7
0
def mock_team(sc):
    tm = yfa.Team(sc, '268.l.46645')
    tm.inject_yhandler(mock_yhandler.YHandler())
    yield tm
def mock_nhl_league(sc):
    lg = yfa.League(sc, '396.l.21484')
    lg.inject_yhandler(mock_yhandler.YHandler())
    yield lg