How to use fpl - 10 common examples

To help you get started, we’ve selected a few fpl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amosbastian / fpl / tests / test_fpl.py View on Github external
async def test_init(self, loop):
        session = aiohttp.ClientSession()
        fpl = FPL(session)
        assert fpl.session is session
        keys = [
            "events",
            "game_settings",
            "phases",
            "teams",
            "elements",
            "element_types",
            "element_stats",
            "total_players",
            "current_gameweek",
        ]
        assert all([hasattr(fpl, key) for key in keys])
        assert all([isinstance(getattr(fpl, key), dict) for key in keys[:-3]])
        assert isinstance(getattr(fpl, keys[-3]), list)
        assert all([isinstance(getattr(fpl, key), int) for key in keys[-2:]])
github amosbastian / fpl / tests / test_fixture.py View on Github external
def test_init():
        fixture = Fixture(fixture_data)
        for k, v in fixture_data.items():
            if k != 'stats':
                assert getattr(fixture, k) == v
github amosbastian / fpl / tests / test_classic_league.py View on Github external
async def test_init(self, loop):
        session = aiohttp.ClientSession()
        classic_league = ClassicLeague(classic_league_data, session)
        assert classic_league._session is session
        for k, v in classic_league_data.items():
            assert getattr(classic_league, k) == v
        await session.close()
github amosbastian / fpl / tests / test_h2h_league.py View on Github external
async def test_init(self, loop):
        session = aiohttp.ClientSession()
        league = H2HLeague(h2h_league_data, session)
        assert league._session == session
        for k, v in h2h_league_data.items():
            assert getattr(league, k) == v
        await session.close()
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_captain():
        user_picks = get_picks()
        captain = next(p for p in user_picks if p["is_captain"])
        _set_captain(user_picks, 145, "is_captain", user_player_ids)

        new_captain = next(p for p in user_picks if p["is_captain"])

        assert new_captain["element"] == 145
        assert not captain["is_captain"]
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_captain_to_vice():
        user_picks = get_picks()
        captain = next(p for p in user_picks if p["is_captain"])
        vice_captain = next(p for p in user_picks if p["is_vice_captain"])
        _set_captain(user_picks, 270, "is_vice_captain", user_player_ids)

        new_captain = next(p for p in user_picks if p["is_captain"])
        new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])

        assert new_captain["element"] == vice_captain["element"]
        assert new_vice_captain["element"] == captain["element"]
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_vice_to_vice():
        user_picks = get_picks()
        vice_captain = next(p for p in user_picks if p["is_vice_captain"])
        _set_captain(user_picks, 302, "is_vice_captain", user_player_ids)
        new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])

        assert new_vice_captain["element"] == vice_captain["element"]
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_vice_to_captain():
        user_picks = get_picks()
        captain = next(p for p in user_picks if p["is_captain"])
        vice_captain = next(p for p in user_picks if p["is_vice_captain"])
        _set_captain(user_picks, 302, "is_captain", user_player_ids)

        new_captain = next(p for p in user_picks if p["is_captain"])
        new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])

        assert new_vice_captain["element"] == captain["element"]
        assert new_captain["element"] == vice_captain["element"]
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_captain_to_captain():
        user_picks = get_picks()
        captain = next(p for p in user_picks if p["is_captain"])
        _set_captain(user_picks, 270, "is_captain", user_player_ids)
        new_captain = next(p for p in user_picks if p["is_captain"])

        assert new_captain["element"] == captain["element"]
github amosbastian / fpl / tests / test_user.py View on Github external
def test__set_captain_vice():
        user_picks = get_picks()
        vice_captain = next(p for p in user_picks if p["is_vice_captain"])
        _set_captain(user_picks, 145, "is_vice_captain", user_player_ids)

        new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])

        assert new_vice_captain["element"] == 145
        assert not vice_captain["is_vice_captain"]