league_tests.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:cslbot 作者: knyte 项目源码 文件源码
def test_decayRatings(self):
        oldCount = self.teams.updateMatchingEntities.call_count
        self._setProp(self.league.SET_RATING_DECAY, "0")
        current = datetime.strftime(datetime.now(), self.league.TIMEFORMAT)
        self._setProp(self.league.SET_LATEST_RUN, current)
        self.league._decayRatings()
        self._setProp(self.league.SET_RATING_DECAY, "10")
        self.league._decayRatings()
        assert_equals(self.teams.updateMatchingEntities.call_count, oldCount)
        self._setProp(self.league.SET_LATEST_RUN, "")
        self.teams.findEntities.return_value = [{'ID': 1, 'Rating': '33/5',
            'Ongoing': '0', 'Finished': '8', 'Limit': '0', 'Confirmations': ''},
            {'ID': 2, 'Rating': '34/8', 'Ongoing': '1', 'Finished': '0',
             'Limit': '3', 'Confirmations': 'TRUE,FALSE,FALSE'},
            {'ID': 3, 'Rating': '39/1', 'Ongoing': '2', 'Finished': '121',
             'Limit': '12', 'Confirmations': 'TRUE,TRUE,TRUE'},
            {'ID': 4, 'Rating': '12/0', 'Ongoing': '0', 'Finished': '0',
             'Limit': '0', 'Confirmations': 'FALSE,FALSE,FALSE'}]
        self.league._decayRatings()
        self.teams.updateMatchingEntities.assert_called_with({'ID':
            {'value': 2, 'type': 'positive'}}, {'Rating': "24/8"})
        assert_equals(self.teams.updateMatchingEntities.call_count, 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号