Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/external-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --no-interaction
run: poetry install --no-interaction -E async
- name: Run external MLB API tests
run: |
poetry run pytest \
Expand Down
39 changes: 39 additions & 0 deletions tests/external_tests/async_mlb/test_async_mlb_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import asyncio

from mlbstatsapi import AsyncMlb
from mlbstatsapi.models.people import Person
from mlbstatsapi.models.schedules import Schedule
from mlbstatsapi.models.teams import Team


def test_async_get_team():
async def scenario():
async with AsyncMlb() as mlb:
team = await mlb.get_team(133)

assert isinstance(team, Team)
assert team.id == 133

asyncio.run(scenario())


def test_async_get_person():
async def scenario():
async with AsyncMlb() as mlb:
person = await mlb.get_person(664034)

assert isinstance(person, Person)
assert person.id == 664034

asyncio.run(scenario())


def test_async_get_schedule():
async def scenario():
async with AsyncMlb() as mlb:
schedule = await mlb.get_schedule(date="2022-10-07")

assert isinstance(schedule, Schedule)
assert schedule.dates

asyncio.run(scenario())
28 changes: 28 additions & 0 deletions tests/external_tests/mlb/test_mlb_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from mlbstatsapi import Mlb
from mlbstatsapi.models.people import Person
from mlbstatsapi.models.schedules import Schedule
from mlbstatsapi.models.teams import Team


def test_get_team():
with Mlb() as mlb:
team = mlb.get_team(133)

assert isinstance(team, Team)
assert team.id == 133


def test_get_person():
with Mlb() as mlb:
person = mlb.get_person(664034)

assert isinstance(person, Person)
assert person.id == 664034


def test_get_schedule():
with Mlb() as mlb:
schedule = mlb.get_schedule(date="2022-10-07")

assert isinstance(schedule, Schedule)
assert schedule.dates
Loading