本文整理汇总了Python中dao.Dao.get_all_tournament_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Dao.get_all_tournament_ids方法的具体用法?Python Dao.get_all_tournament_ids怎么用?Python Dao.get_all_tournament_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dao.Dao
的用法示例。
在下文中一共展示了Dao.get_all_tournament_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDAO
# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_tournament_ids [as 别名]
#.........这里部分代码省略.........
tournament_2.raw = tournament_2_raw_new
tournament_2.name = tournament_2_name_new
self.norcal_dao.update_tournament(tournament_2)
tournament_1 = self.norcal_dao.get_tournament_by_id(self.tournament_id_1)
self.assertEquals(tournament_1.id, self.tournament_id_1)
self.assertEquals(tournament_1.type, self.tournament_type_1)
self.assertEquals(tournament_1.raw, self.tournament_raw_1)
self.assertEquals(tournament_1.date, self.tournament_date_1)
self.assertEquals(tournament_1.name, self.tournament_name_1)
self.assertEquals(tournament_1.matches, self.tournament_matches_1)
self.assertEquals(tournament_1.players, self.tournament_players_1)
self.assertEquals(tournament_1.regions, self.tournament_regions_1)
tournament_2 = self.norcal_dao.get_tournament_by_id(self.tournament_id_2)
self.assertEquals(tournament_2.id, self.tournament_id_2)
self.assertEquals(tournament_2.type, self.tournament_type_2)
self.assertEquals(tournament_2.raw, tournament_2_raw_new)
self.assertEquals(tournament_2.date, self.tournament_date_2)
self.assertEquals(tournament_2.name, tournament_2_name_new)
self.assertEquals(tournament_2.matches, self.tournament_matches_2)
self.assertEquals(tournament_2.players, self.tournament_players_2)
self.assertEquals(tournament_2.regions, self.tournament_regions_2)
def test_update_tournament_empty_raw(self):
tournament_2 = self.norcal_dao.get_tournament_by_id(self.tournament_id_2)
tournament_2.raw = ''
with self.assertRaises(UpdateTournamentException):
self.norcal_dao.update_tournament(tournament_2)
def test_get_all_tournament_ids(self):
tournament_ids = self.norcal_dao.get_all_tournament_ids()
self.assertEquals(len(tournament_ids), 2)
self.assertEquals(tournament_ids[0], self.tournament_id_2)
self.assertEquals(tournament_ids[1], self.tournament_id_1)
def test_get_all_tournaments(self):
tournaments = self.norcal_dao.get_all_tournaments()
self.assertEquals(len(tournaments), 2)
# tournament 1 is last in the list because it occurs later than tournament 2
tournament_1 = tournaments[1]
self.assertEquals(tournament_1.id, self.tournament_id_1)
self.assertEquals(tournament_1.type, self.tournament_type_1)
self.assertEquals(tournament_1.raw, '')
self.assertEquals(tournament_1.date, self.tournament_date_1)
self.assertEquals(tournament_1.name, self.tournament_name_1)
self.assertEquals(tournament_1.matches, self.tournament_matches_1)
self.assertEquals(tournament_1.players, self.tournament_players_1)
self.assertEquals(tournament_1.regions, self.tournament_regions_1)
tournament_2 = tournaments[0]
self.assertEquals(tournament_2.id, self.tournament_id_2)
self.assertEquals(tournament_2.type, self.tournament_type_2)
self.assertEquals(tournament_2.raw, '')
self.assertEquals(tournament_2.date, self.tournament_date_2)
self.assertEquals(tournament_2.name, self.tournament_name_2)
self.assertEquals(tournament_2.matches, self.tournament_matches_2)
self.assertEquals(tournament_2.players, self.tournament_players_2)
self.assertEquals(tournament_2.regions, self.tournament_regions_2)
示例2: TestDAO
# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_tournament_ids [as 别名]
#.........这里部分代码省略.........
tournament_2_name_new = 'new tournament 2 name'
tournament_2.name = tournament_2_name_new
self.norcal_dao.update_tournament(tournament_2)
tournament_1 = self.norcal_dao.get_tournament_by_id(
self.tournament_id_1)
self.assertEquals(tournament_1.id, self.tournament_id_1)
self.assertEquals(tournament_1.type, self.tournament_type_1)
self.assertEquals(tournament_1.date, self.tournament_date_1)
self.assertEquals(tournament_1.name, self.tournament_name_1)
self.assertEquals(tournament_1.matches, self.tournament_matches_1)
self.assertEquals(tournament_1.players, self.tournament_players_1)
self.assertEquals(tournament_1.regions, self.tournament_regions_1)
tournament_2 = self.norcal_dao.get_tournament_by_id(
self.tournament_id_2)
self.assertEquals(tournament_2.id, self.tournament_id_2)
self.assertEquals(tournament_2.type, self.tournament_type_2)
self.assertEquals(tournament_2.date, self.tournament_date_2)
self.assertEquals(tournament_2.name, tournament_2_name_new)
self.assertEquals(tournament_2.matches, self.tournament_matches_2)
self.assertEquals(tournament_2.players, self.tournament_players_2)
self.assertEquals(tournament_2.regions, self.tournament_regions_2)
def test_delete_tournament(self):
tournament = self.norcal_dao.get_tournament_by_id(self.tournament_id_1)
self.norcal_dao.delete_tournament(tournament)
deleted_tournament = self.norcal_dao.get_tournament_by_id(
self.tournament_id_1)
self.assertIsNone(deleted_tournament)
def test_get_all_tournament_ids(self):
tournament_ids = self.norcal_dao.get_all_tournament_ids()
self.assertEquals(len(tournament_ids), 2)
self.assertEquals(tournament_ids[0], self.tournament_id_2)
self.assertEquals(tournament_ids[1], self.tournament_id_1)
def test_get_all_tournaments(self):
tournaments = self.norcal_dao.get_all_tournaments()
self.assertEquals(len(tournaments), 2)
# tournament 1 is last in the list because it occurs later than
# tournament 2
tournament_1 = tournaments[1]
self.assertEquals(tournament_1.id, self.tournament_id_1)
self.assertEquals(tournament_1.type, self.tournament_type_1)
self.assertEquals(tournament_1.date, self.tournament_date_1)
self.assertEquals(tournament_1.name, self.tournament_name_1)
self.assertEquals(tournament_1.matches, self.tournament_matches_1)
self.assertEquals(tournament_1.players, self.tournament_players_1)
self.assertEquals(tournament_1.regions, self.tournament_regions_1)
tournament_2 = tournaments[0]
self.assertEquals(tournament_2.id, self.tournament_id_2)
self.assertEquals(tournament_2.type, self.tournament_type_2)
self.assertEquals(tournament_2.date, self.tournament_date_2)
self.assertEquals(tournament_2.name, self.tournament_name_2)
self.assertEquals(tournament_2.matches, self.tournament_matches_2)
self.assertEquals(tournament_2.players, self.tournament_players_2)
self.assertEquals(tournament_2.regions, self.tournament_regions_2)
def test_get_all_tournaments_for_region(self):