def test_first_teams(_get): _get().content = open('tests/fixtures/teams.html').read() team = baseball.teams()[0] assert_equals(team['name'], 'Baltimore Orioles') assert_equals(team['league'], 'AMERICAN') assert_equals(team['division'], 'EAST') assert_equals(team['links']['schedule'], 'http://espn.go.com/mlb/teams/schedule?team=bal')
def test_all_teams(_get): _get().content = open('tests/fixtures/teams.html').read() teams = baseball.teams() assert_equals(len(teams), 30)
import json from vogeltron import baseball with open('vogeltron/teams.json', 'w') as f: json.dump(baseball.teams(), f)