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)
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)
def test_creation(self): db.init(':memory:') db.create_tables([Player, Person]) generator = PlayerGenerator() self.assertIsNotNone(generator) random_player = generator.generate() self.assertIsNotNone(random_player) self.assertIsNotNone(random_player.person) self.assertIsNotNone(random_player.position)
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)
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)
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)
def setUp(self): db.init(':memory:') db.create_tables([ PMDataObject ]) self.data_object = PMDataObject() self.data_object.save()
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)
def setUp(self): db.init(':memory:') db.create_tables([Person]) self.name = Name(forename = "Trevor", surname = "Linden") self.person = Person.create(forename=self.name.forename, surname=self.name.surname)