Esempio n. 1
0
 def setUp(self):
     # TODO Lots of redundancy here with main app and other tests. Can we
     # abstract?
     db.init(':memory:')
     classes = PMDataObject.__subclasses__()
     db.create_tables(classes)
     for class_ in classes:
         if class_.__name__ not in PMDataObject.deferred_relations:
             PMDataObject.deferred_relations[class_.__name__] = class_
     league = League.create(name="Band Battle")
     season = Season.create(league=league,
             start_year=2016,
             end_year=2017,
             is_current=True)
     self.team1 = Team.create(name="Sex Bob-omb",
             city="Toronto",
             skill=90,
             abbreviation="SBO",
             league=league)
     TeamStats.create(team=self.team1, season=season)
     self.team2 = Team.create(name="The Clash at Demonhead",
             city="New York",
             skill=90,
             abbreviation="TCD",
             league=league)
     TeamStats.create(team=self.team2, season=season)
Esempio n. 2
0
    def setUp(self):
        db.init(':memory:')
        classes = [Team, League, Season, Person, Player, PlayerStats]
        db.create_tables(classes)
        for class_ in classes:
            if class_.__name__ not in PMDataObject.deferred_relations:
                PMDataObject.deferred_relations[class_.__name__] = class_
        
        self.league = League.create(name="Band Battle")
        self.season = Season.create(league=self.league,
                start_year=2016,
                end_year=2017,
                is_current=True)

        self.team = Team.create(name="Sex Bob-omb", 
                city="Toronto", 
                skill=90,
                abbreviation="TOR", 
                league=self.league)
        self.person = Person.create(forename="Scott", surname="Pilgrim")
        self.player = Player.create(person=self.person,
                team=self.team,
                position="F",
                scoring_rate=12.0,
                shot_rate=12.0,
                )
        self.stats = PlayerStats.create(player=self.player,
                season=self.season,
                team=self.team)
Esempio n. 3
0
def create_test_league():
    """This method creates a junk league for demo purposes"""
    main_league = League.create(name="Fake League")
    Team.create(league=main_league, name = "Komets", city = "Fort Wayne", skill = 2.5, abbreviation = "FTW")
    Team.create(league=main_league, name = "Ice", city = "Indianapolis", skill = 2.4, abbreviation = "IND")
    Team.create(league=main_league, name = "Aeros", city = "Houston", skill = 2.3, abbreviation = "HOU")
    Team.create(league=main_league, name = "Whoopie", city = "Macon", skill = 2.1, abbreviation = "MAC")
    new_season(main_league)

    return main_league
Esempio n. 4
0
    def setUp(self):
        db.init(':memory:')
        db.create_tables([Team, League, Season])
        PMDataObject.deferred_relations['Season'] = Season

        self.league = League.create(name="Band Battle")
        self.season = Season.create(league=self.league,
                start_year=2016,
                end_year=2017,
                is_current=True)
        self.team = Team.create(name="Sex Bob-omb",
                city="Toronto",
                skill=90,
                abbreviation="TOR",
                league=self.league)
Esempio n. 5
0
    def setUp(self):
        db.init(':memory:')
        classes = [Team, League, Season, TeamStats]
        db.create_tables(classes)
        for class_ in classes:
            if class_.__name__ not in PMDataObject.deferred_relations:
                PMDataObject.deferred_relations[class_.__name__] = class_
        
        self.league = League.create(name="Band Battle")
        self.season = Season.create(league=self.league,
                start_year=2016,
                end_year=2017,
                is_current=True)

        self.team = Team.create(name="Sex Bob-omb", 
                city="Toronto", 
                skill=90,
                abbreviation="TOR", 
                league=self.league)

        self.team_stats = TeamStats.create(team=self.team,
                season=self.season)
Esempio n. 6
0
    def setUp(self):
        db.init(':memory:')
        classes = [Team, League, Season, PlayerStats, Person, Player]
        db.create_tables(classes)
        for class_ in classes:
            if class_.__name__ not in PMDataObject.deferred_relations:
                PMDataObject.deferred_relations[class_.__name__] = class_
        self.league = League.create(name="NHL")
        self.team = Team.create(name="Canucks",
                city="Vancouver",
                skill=100,
                abbreviation="VAN",
                league=self.league)
        self.person = Person.create_from_name(name=Name(forename = "Cliff",
            surname = "Ronning"))
        self.player = Player.create(person=self.person, team = self.team,
                position = "C", scoring_rate=0.07, shot_rate=6)

        self.season = Season.create(league=self.league,
                start_year=2016,
                end_year=2017,
                is_current=True)
Esempio n. 7
0
    def setUp(self):
        db.init(':memory:')
        db.create_tables([League, Season])

        self.league = League.create(name="Band Battle")
        self.season = Season.create(league=self.league, start_year=2016, end_year=2017)