本文整理汇总了Python中dao.Dao.reset_all_player_ratings方法的典型用法代码示例。如果您正苦于以下问题:Python Dao.reset_all_player_ratings方法的具体用法?Python Dao.reset_all_player_ratings怎么用?Python Dao.reset_all_player_ratings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dao.Dao
的用法示例。
在下文中一共展示了Dao.reset_all_player_ratings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDAO
# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import reset_all_player_ratings [as 别名]
#.........这里部分代码省略.........
self.assertTrue(self.player_3.exclude)
self.dao.include_player(self.player_3)
self.assertFalse(self.player_3.exclude)
self.assertEquals(self.dao.get_excluded_players(), [])
def test_add_alias_to_player(self):
new_alias = 'gaRRR'
lowercase_alias = 'garrr'
old_expected_aliases = ['gar', 'garr']
new_expected_aliases = ['gar', 'garr', 'garrr']
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).aliases, old_expected_aliases)
self.assertEquals(self.player_1.aliases, old_expected_aliases)
self.dao.add_alias_to_player(self.player_1, new_alias)
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).aliases, new_expected_aliases)
self.assertEquals(self.player_1.aliases, new_expected_aliases)
def test_add_alias_to_player_duplicate(self):
with self.assertRaises(DuplicateAliasException):
self.dao.add_alias_to_player(self.player_1, 'garr')
def test_update_player_name(self):
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).name, 'gaR')
self.assertEquals(self.player_1.name, 'gaR')
self.dao.update_player_name(self.player_1, 'gaRR')
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).name, 'gaRR')
self.assertEquals(self.player_1.name, 'gaRR')
def test_update_player_name_non_alias(self):
with self.assertRaises(InvalidNameException):
self.dao.update_player_name(self.player_1, 'asdf')
def test_reset_all_player_ratings(self):
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).rating, TrueskillRating())
self.assertEquals(self.dao.get_player_by_id(self.player_2_id).rating, TrueskillRating())
self.assertEquals(self.dao.get_player_by_id(self.player_3_id).rating,
TrueskillRating(trueskill_rating=trueskill.Rating(mu=2, sigma=3)))
self.dao.reset_all_player_ratings()
self.assertEquals(self.dao.get_player_by_id(self.player_1_id).rating, TrueskillRating())
self.assertEquals(self.dao.get_player_by_id(self.player_2_id).rating, TrueskillRating())
self.assertEquals(self.dao.get_player_by_id(self.player_3_id).rating, TrueskillRating())
def test_update_tournament(self):
tournament_1 = self.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)
tournament_2 = self.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, self.tournament_raw_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)
tournament_2_raw_new = 'asdfasdf'
tournament_2_name_new = 'new tournament 2 name'