示例#1
0
    def to_team(self, team_key):
        """Construct a Team object from a League

        :param team_key: Team key of the new Team object to construct
        :type team_key: str
        :return: Fully constructed object
        :rtype: Team
        """
        tm = yfa.Team(self.sc, team_key)
        tm.inject_yhandler(self.yhandler)
        return tm
示例#2
0
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')
示例#3
0
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')
示例#4
0
def mock_team(sc):
    tm = yfa.Team(sc, '268.l.46645')
    tm.inject_yhandler(mock_yhandler.YHandler())
    yield tm