test_players.py 文件源码

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

项目:CatLaser2 作者: adafruit 项目源码 文件源码
def test_update_moves_to_next_after_playetime_elapsed(self):
        # Setup, add two players and make the first active.
        laser_players = players.Players(1)
        laser_players.add_player('192.168.0.1')
        laser_players.add_player('192.168.0.2')
        start_active = unittest.mock.Mock()
        end_active = unittest.mock.Mock()
        laser_players.update(1, start_active, end_active)
        start_active.reset_mock()
        end_active.reset_mock()
        # Update with two seconds of time so the first player time is up, then
        # check next player is active.
        laser_players.update(2, start_active, end_active)
        end_active.assert_called_once_with('192.168.0.1')
        start_active.assert_called_once_with('192.168.0.2')
        self.assertEqual(('192.168.0.2', 1), laser_players.active_player())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号