def venue_data(): england = mco.Countries(name=u"England", confederation=enums.ConfederationType.europe) tz_london = mco.Timezones(name=u"Europe/London", offset=0.0, confederation=enums.ConfederationType.europe) return { "name": "Emirates Stadium", "city": "London", "country": england, "timezone": tz_london, "latitude": 51.555000, "longitude": -0.108611, "altitude": 41 }
def test_timezone_insert(session): """Timezone 001: Insert timezone records into Timezones table and verify data.""" timezones = [ mco.Timezones(name=u"Europe/Paris", offset=1, confederation=enums.ConfederationType.europe), mco.Timezones(name=u"America/New_York", offset=-5.0, confederation=enums.ConfederationType.north_america), mco.Timezones(name=u"Asia/Kathmandu", offset=+5.75, confederation=enums.ConfederationType.asia) ] session.add_all(timezones) tz_uefa = session.query(mco.Timezones).filter_by( confederation=enums.ConfederationType.europe).one() assert repr( tz_uefa ) == "<Timezone(name=Europe/Paris, offset=+1.00, confederation=UEFA)>" stmt = session.query(func.min( mco.Timezones.offset).label('far_west')).subquery() tz_farwest = session.query( mco.Timezones).filter(mco.Timezones.offset == stmt.c.far_west).one() assert repr( tz_farwest ) == "<Timezone(name=America/New_York, offset=-5.00, confederation=CONCACAF)>" stmt = session.query(func.max( mco.Timezones.offset).label('far_east')).subquery() tz_fareast = session.query( mco.Timezones).filter(mco.Timezones.offset == stmt.c.far_east).one() assert repr( tz_fareast ) == "<Timezone(name=Asia/Kathmandu, offset=+5.75, confederation=AFC)>"
def national_data(): mexico = mco.Countries(name=u"Mexico", confederation=enums.ConfederationType.north_america) england = mco.Countries(name=u"England", confederation=enums.ConfederationType.europe) france = mco.Countries(name=u"France", confederation=enums.ConfederationType.europe) italy = mco.Countries(name=u"Italy", confederation=enums.ConfederationType.europe) tz_london = mco.Timezones(name=u"Europe/London", offset=0.0, confederation=enums.ConfederationType.europe) return { 'date': date(1997, 11, 12), 'competition': mco.InternationalCompetitions( name=u"International Cup", level=1, confederation=enums.ConfederationType.fifa), 'season': mco.Seasons(start_year=mco.Years(yr=1997), end_year=mco.Years(yr=1998)), 'venue': mco.Venues(name=u"Emirates Stadium", city=u"London", country=england, timezone=tz_london), 'home_team': france, 'away_team': mexico, 'home_manager': mcp.Managers(first_name=u"Arsène", last_name=u"Wenger", birth_date=date(1949, 10, 22), country=france), 'away_manager': mcp.Managers(first_name=u"Gary", last_name=u"Simpson", birth_date=date(1961, 4, 11), country=england), 'referee': mcp.Referees(first_name=u"Pierluigi", last_name=u"Collina", birth_date=date(1960, 2, 13), country=italy) }
def club_data(): england = mco.Countries(name=u"England", confederation=enums.ConfederationType.europe) france = mco.Countries(name=u"France", confederation=enums.ConfederationType.europe) tz_london = mco.Timezones(name=u"Europe/London", offset=0.0, confederation=enums.ConfederationType.europe) return { 'date': date(2015, 1, 1), 'competition': mco.DomesticCompetitions(name=u'Test Competition', level=1, country=england), 'season': mco.Seasons(start_year=mco.Years(yr=2014), end_year=mco.Years(yr=2015)), 'venue': mco.Venues(name=u"Emirates Stadium", city=u"London", country=england, timezone=tz_london), 'home_team': mc.Clubs(name=u"Arsenal FC", country=england), 'away_team': mc.Clubs(name=u"Lincoln City FC", country=england), 'home_manager': mcp.Managers(first_name=u"Arsène", last_name=u"Wenger", birth_date=date(1949, 10, 22), country=france), 'away_manager': mcp.Managers(first_name=u"Gary", last_name=u"Simpson", birth_date=date(1961, 4, 11), country=england), 'referee': mcp.Referees(first_name=u"Mark", last_name=u"Clattenburg", birth_date=date(1975, 3, 13), country=england) }