Exemple #1
0
def match_data(comp_data, season_data, venue_data, person_data):
    return {
        "date":
        date(2012, 12, 12),
        "competition":
        mco.DomesticCompetitions(**comp_data['domestic']),
        "season":
        mco.Seasons(**{k: mco.Years(**v)
                       for k, v in season_data.items()}),
        "venue":
        mco.Venues(**venue_data),
        "home_manager":
        mcp.Managers(**person_data['manager'][0]),
        "away_manager":
        mcp.Managers(**person_data['manager'][1]),
        "referee":
        mcp.Referees(**person_data['referee'][0])
    }
Exemple #2
0
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)
    }
Exemple #3
0
def test_domestic_competition_insert(session):
    """Domestic Competition 001: Insert domestic competition record and verify data."""
    comp_name = u"English Premier League"
    comp_country = u"England"
    comp_level = 1
    record = mco.DomesticCompetitions(
        name=comp_name,
        level=comp_level,
        country=mco.Countries(name=comp_country,
                              confederation=enums.ConfederationType.europe))
    session.add(record)

    competition = session.query(mco.DomesticCompetitions).one()

    assert repr(
        competition
    ) == "<DomesticCompetition(name={0}, country={1}, level={2})>".format(
        comp_name, comp_country, comp_level)
    assert competition.name == comp_name
    assert competition.level == comp_level
    assert competition.country.name == comp_country