本文整理汇总了Python中lib.game.Game.play方法的典型用法代码示例。如果您正苦于以下问题:Python Game.play方法的具体用法?Python Game.play怎么用?Python Game.play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.game.Game
的用法示例。
在下文中一共展示了Game.play方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_play_states_when_the_player_wins
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import play [as 别名]
def test_play_states_when_the_player_wins(mocker):
mocker.patch('lib.console.display')
mocker.patch('lib.player_input.read_choice', return_value="p")
mocker.patch('lib.computer_input.read_choice', return_value="r")
Game.play()
lib.console.display.assert_any_call("Player wins!")
示例2: test_play_states_when_a_tie_occurres
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import play [as 别名]
def test_play_states_when_a_tie_occurres(mocker):
mocker.patch('lib.console.display')
mocker.patch('lib.player_input.read_choice', return_value="r")
mocker.patch('lib.computer_input.read_choice', return_value="r")
Game.play()
lib.console.display.assert_any_call("It's a tie!")
示例3: test_play_computers_choice_is_displayed
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import play [as 别名]
def test_play_computers_choice_is_displayed(mocker):
mocker.patch('lib.console.display')
mocker.patch('lib.console.display_no_newline')
mocker.patch('lib.player_input.read_choice')
mocker.patch('lib.computer_input.read_choice', return_value="p")
Game.play()
lib.console.display.assert_any_call("Computer played Paper!")
示例4: test_play_computers_choice_is_displayed_if_computer_picks_other_option
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import play [as 别名]
def test_play_computers_choice_is_displayed_if_computer_picks_other_option(mocker):
mocker.patch('lib.console.display')
mocker.patch('lib.console.display_no_newline')
mocker.patch('lib.player_input.read_choice')
mocker.patch('lib.computer_input.read_choice', return_value="r")
Game.play()
lib.console.display.assert_any_call("Computer played Rock!")
示例5: test_play_prompts_for_users_option
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import play [as 别名]
def test_play_prompts_for_users_option(mocker):
mocker.patch('lib.console.display')
mocker.patch('lib.console.display_no_newline')
mocker.patch('lib.player_input.read_choice')
mocker.patch('lib.computer_input.read_choice')
Game.play()
lib.console.display.assert_any_call("Rock (r), Paper (p) or Scissors (s):")