本文整理汇总了Python中tests.test_utils.print_test_header函数的典型用法代码示例。如果您正苦于以下问题:Python print_test_header函数的具体用法?Python print_test_header怎么用?Python print_test_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_test_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_end_tie
def test_end_tie(self):
tu.print_test_header("test end tie")
self.game.turn = 1
for i in range(0, 6):
self.player1.gain("Province")
self.player2.gain("Province")
self.assertTrue(self.game.detect_end())
示例2: test_Bazaar
def test_Bazaar(self):
tu.print_test_header("test Bazaar")
bazaar = sea.Bazaar(self.game, self.player1)
bazaar.play()
self.assertTrue(self.player1.actions == 2)
self.assertTrue(len(self.player1.hand) == 6)
self.assertTrue(self.player1.balance == 1)
示例3: test_Merchant_Ship
def test_Merchant_Ship(self):
tu.print_test_header("test Merchant Ship")
merchant_ship = sea.Merchant_Ship(self.game, self.player1)
merchant_ship.play()
self.assertTrue(self.player1.balance == 2)
merchant_ship.duration()
self.assertTrue(self.player1.balance == 4)
示例4: test_Trader
def test_Trader(self):
tu.print_test_header("test Trader")
witch = base.Witch(self.game, self.player1)
trader = hl.Trader(self.game, self.player2)
#2 curses left
for i in range(0, self.game.supply.get_count("Curse")-2):
self.game.remove_from_supply("Curse")
self.player1.hand.add(witch)
self.player2.hand.add(trader)
#reaction
tu.send_input(self.player1, "play", "Witch")
self.assertTrue(self.player1.last_mode["mode"] == "wait")
yield tu.send_input(self.player2, "post_selection", ["Reveal"])
self.assertTrue(len(self.game.trash_pile) == 0)
#and gained a silver
self.assertTrue(self.player2.discard_pile[-1].title == "Silver")
yield gen.sleep(.1)
self.assertTrue(self.player1.last_mode["mode"] != "wait")
self.assertTrue(self.player3.discard_pile[-1].title == "Curse")
#one curse returned to supply
self.assertTrue(self.game.supply.get_count("Curse") == 1)
self.assertTrue(self.game.empty_piles == 0)
self.player1.end_turn()
self.player2.hand.add(supply_cards.Estate(self.game, self.player2))
tu.send_input(self.player2, "play", "Trader")
yield tu.send_input(self.player2, "post_selection", ["Estate"])
self.assertTrue(len(self.player2.discard_pile) == 3)
示例5: test_Forge
def test_Forge(self):
tu.print_test_header("test Forge")
forge = prosperity.Forge(self.game, self.player1)
steward = intrigue.Steward(self.game, self.player1)
minion = intrigue.Minion(self.game, self.player1)
torturer = intrigue.Torturer(self.game, self.player1)
secret_chamber = intrigue.Secret_Chamber(self.game, self.player1)
gold = supply_cards.Gold(self.game, self.player1)
self.player1.hand.add(steward)
self.player1.hand.add(minion)
self.player1.hand.add(torturer)
self.player1.hand.add(secret_chamber)
self.player1.hand.add(gold)
forge.play()
# trash prices total to 8
yield tu.send_input(self.player1, "post_selection", ["Steward", "Copper", "Copper", "Minion"])
self.assertTrue(len(self.game.trash_pile) == 4)
yield tu.send_input(self.player1, "selectSupply", ["Province"])
self.assertTrue(self.player1.discard_pile[0].title == "Province")
forge.play()
# trash prices total to 13 -- nothing to gain
yield tu.send_input(self.player1, "post_selection", ["Torturer", "Secret Chamber", "Gold"])
self.assertTrue(self.player1.cb is None)
示例6: test_remove_from_supply
def test_remove_from_supply(self):
tu.print_test_header("test remove from supply")
self.assertTrue(self.game.supply.get_count("Estate") == 12)
self.assertTrue(self.game.base_supply.get_count("Estate") == 12)
self.game.remove_from_supply("Estate")
self.assertTrue(self.game.supply.get_count("Estate") == 11)
self.assertTrue(self.game.base_supply.get_count("Estate") == 11)
示例7: test_throne_room_throne_room
def test_throne_room_throne_room(self):
tu.print_test_header("Test throne room throne room")
throneroom = base.Throne_Room(self.game, self.player1)
throneroom2 = base.Throne_Room(self.game, self.player1)
self.player1.hand.add(throneroom)
self.player1.hand.add(throneroom2)
yield tu.send_input(self.player1, "play", "Throne Room")
yield tu.send_input(self.player1, "post_selection", ["Throne Room"])
self.player1.end_turn()
self.player2.end_turn()
self.player3.end_turn()
self.player1.hand.add(throneroom)
self.player1.hand.add(throneroom2)
self.player1.hand.add(base.Village(self.game, self.player1))
self.player1.hand.add(base.Village(self.game, self.player1))
self.player1.hand.add(base.Woodcutter(self.game, self.player1))
yield tu.send_input(self.player1, "play", "Throne Room")
yield tu.send_input(self.player1, "post_selection", ["Village"])
self.assertTrue(self.player1.actions == 4)
self.assertTrue(self.player1.last_mode["mode"] == "action")
yield tu.send_input(self.player1, "play", "Throne Room")
yield tu.send_input(self.player1, "post_selection", ["Woodcutter"])
self.assertTrue(self.player1.balance == 4)
self.assertTrue(self.player1.last_mode["mode"] == "action")
示例8: test_Militia
def test_Militia(self):
tu.print_test_header("test Militia")
player2_discard_future = gen.Future()
player3_discard_future = gen.Future()
select_mock2 = unittest.mock.MagicMock(return_value=player2_discard_future)
select_mock3 = unittest.mock.MagicMock(return_value=player3_discard_future)
discard_mock2 =unittest.mock.Mock()
discard_mock3 =unittest.mock.Mock()
self.player2.select = select_mock2
self.player3.select = select_mock3
self.player2.discard = gen.coroutine(discard_mock2)
self.player3.discard = gen.coroutine(discard_mock3)
base.Militia(self.game, self.player1).play()
self.assertTrue(select_mock2.called)
self.assertTrue(select_mock3.called)
select_mock2.assert_called_with(unittest.mock.ANY, unittest.mock.ANY,
crd.card_list_to_titles(self.player2.hand.card_array()), unittest.mock.ANY)
player2_selection = crd.card_list_to_titles(self.player2.hand.card_array())[:2]
player2_discard_future.set_result(player2_selection)
yield gen.moment
discard_mock2.assert_called_once_with(player2_selection, self.player2.discard_pile)
self.assertTrue(self.player1.last_mode["mode"] == "wait")
player3_selection = ["Copper", "Copper"]
player3_discard_future.set_result(player3_selection)
yield gen.moment
discard_mock3.assert_called_once_with(player3_selection, self.player3.discard_pile)
示例9: test_Throne_Room_on_Workshop
def test_Throne_Room_on_Workshop(self):
tu.print_test_header("test Throne Room workshop")
throne_room = base.Throne_Room(self.game, self.player1)
workshop = base.Workshop(self.game, self.player1)
self.player1.hand.add(workshop)
self.player1.hand.add(throne_room)
select_future = gen.Future()
select_from_supply_future = gen.Future()
select_from_supply_future2 = gen.Future()
self.player1.select = unittest.mock.MagicMock(return_value=select_future)
self.player1.select_from_supply = unittest.mock.MagicMock(side_effect=[select_from_supply_future, select_from_supply_future2])
self.player1.gain = unittest.mock.Mock(wraps=self.player1.gain)
throne_room.play()
select_future.set_result(["Workshop"])
yield gen.moment
select_from_supply_future.set_result(["Silver"])
yield gen.moment
self.player1.gain.assert_called_once_with("Silver")
select_from_supply_future2.set_result(["Estate"])
yield gen.moment
self.player1.gain.assert_called_with("Estate")
示例10: test_Duchess
def test_Duchess(self):
tu.print_test_header("Test Duchess")
duchess = hl.Duchess(self.game, self.player1)
self.player1.hand.add(duchess)
player1top = self.player1.deck[-1]
player2top = self.player2.deck[-1]
player3top = self.player3.deck[-1]
tu.send_input(self.player1, "play", "Duchess")
self.assertTrue(self.player1.balance == 2)
self.assertTrue(self.player1.last_mode["mode"] == "select")
self.assertTrue(self.player2.last_mode["mode"] == "select")
self.assertTrue(self.player3.last_mode["mode"] == "select")
yield tu.send_input(self.player2, "post_selection", ["Discard"])
self.assertTrue(self.player1.last_mode["mode"] == "select")
self.assertTrue(self.player2.discard_pile[-1] == player2top)
self.assertTrue(self.player2.last_mode["mode"] != "select")
yield tu.send_input(self.player1, "post_selection", ["Put Back"])
self.assertTrue(self.player1.deck[-1] == player1top)
self.assertTrue(self.player1.last_mode["mode"] == "wait")
yield tu.send_input(self.player3, "post_selection", ["Discard"])
self.assertTrue(self.player1.last_mode["mode"] != "wait")
self.player1.end_turn()
self.player2.balance = 5
yield tu.send_input(self.player2, "buyCard", "Duchy")
self.assertTrue(self.player2.last_mode["mode"] == "select")
yield tu.send_input(self.player2, "post_selection", ["Yes"])
self.assertTrue(self.player2.last_mode["mode"] != "select")
self.assertTrue(self.player2.discard_pile[-1].title == "Duchess")
示例11: test_Scheme
def test_Scheme(self):
tu.print_test_header("test Scheme")
scheme1 = hl.Scheme(self.game, self.player1)
scheme2 = hl.Scheme(self.game, self.player2)
tu.add_many_to_hand(self.player1, scheme1, 2)
self.player2.hand.add(scheme2)
tu.send_input(self.player1, "play", "Scheme")
tu.send_input(self.player1, "play", "Scheme")
self.player1.end_turn()
self.assertTrue(self.player1.last_mode["mode"] == "select")
yield tu.send_input(self.player1, "post_selection", ["Scheme", "Scheme"])
self.assertTrue(self.game.get_turn_owner() == self.player2)
self.assertTrue(self.player1.hand.get_count("Scheme") == 2)
tu.send_input(self.player2, "play", "Scheme")
self.player2.end_turn()
self.assertTrue(self.player2.last_mode["mode"] == "select")
self.assertTrue(self.player2.last_mode["max_cards"] == 1)
yield tu.send_input(self.player2, "post_selection", ["Scheme"])
self.player3.end_turn()
self.assertTrue(self.player3.last_mode["mode"] != "select")
示例12: test_Fools_Gold
def test_Fools_Gold(self):
tu.print_test_header("test Fool's Gold")
fg = hl.Fools_Gold(self.game, self.player1)
tu.clear_player_hand(self.player1)
tu.add_many_to_hand(self.player1, fg, 3)
fg2 = hl.Fools_Gold(self.game, self.player3)
tu.add_many_to_hand(self.player3, fg2, 2)
yield tu.send_input(self.player1, "play", "Fool's Gold")
yield tu.send_input(self.player1, "play", "Fool's Gold")
yield tu.send_input(self.player1, "play", "Fool's Gold")
self.assertTrue(self.player1.balance == 9)
yield tu.send_input(self.player1, "buyCard", "Province")
self.assertTrue(self.player3.last_mode["mode"] == "select")
self.assertTrue(self.game.get_turn_owner() == self.player1)
# Trash fool's gold
yield tu.send_input(self.player3, "post_selection", ["Yes"])
self.assertTrue(len(self.player3.hand) == 6)
self.assertTrue(self.player3.deck[-1].title == "Gold")
self.assertTrue(self.game.trash_pile[-1].title == "Fool's Gold")
self.assertTrue(self.player3.last_mode["mode"] == "select")
yield tu.send_input(self.player3, "post_selection", ["Yes"])
self.assertTrue(self.player3.deck[-2].title == "Gold")
示例13: test_watchtower_trader
def test_watchtower_trader(self):
tu.print_test_header("test Watchtower Trader")
watchtower = prosperity.Watchtower(self.game, self.player1)
trader = hl.Trader(self.game, self.player1)
self.player1.hand.add(watchtower)
self.player1.hand.add(trader)
self.player1.spend_all_money()
yield tu.send_input(self.player1, "buyCard", "Copper")
self.assertTrue(self.player1.last_mode["mode"] == "select")
#order reactions, reveal trader then watchtower
yield tu.send_input(self.player1, "post_selection", ["Watchtower", "Trader"])
self.assertTrue(self.player1.last_mode["mode"] == "select")
#reveal trader
yield tu.send_input(self.player1, "post_selection", ["Reveal"])
self.assertTrue(self.game.supply.get_count("Copper") == 30)
#gaining silver now
yield tu.send_input(self.player1, "post_selection", ["Watchtower", "Trader"])
# trader's reaction is ignored since its for silver
# reveal watchtower
yield tu.send_input(self.player1, "post_selection", ["Reveal"])
yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"])
self.assertTrue(self.player1.deck[-1].title == "Silver")
#watchtower from the copper earlier
yield tu.send_input(self.player1, "post_selection", ["Reveal"])
yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"])
self.assertTrue(self.player1.deck[-1].title == "Silver")
示例14: test_City
def test_City(self):
tu.print_test_header("test City")
city = prosperity.City(self.game, self.player1)
cards_in_hand = len(self.player1.hand.card_array())
city.play()
self.assertTrue(self.player1.balance == 0)
self.assertTrue(self.player1.actions == 2)
self.assertTrue(len(self.player1.hand.card_array()) == cards_in_hand + 1)
self.assertTrue(self.player1.buys == 1)
self.assertTrue(self.player1.balance == 0)
self.game.empty_piles = 1
city.play()
self.assertTrue(len(self.player1.hand.card_array()) == cards_in_hand + 3)
self.assertTrue(self.player1.actions == 3)
self.assertTrue(self.player1.buys == 1)
self.assertTrue(self.player1.balance == 0)
self.game.empty_piles = 2
city.play()
self.assertTrue(len(self.player1.hand.card_array()) == cards_in_hand + 5)
self.assertTrue(self.player1.actions == 4)
self.assertTrue(self.player1.buys == 2)
self.assertTrue(self.player1.balance == 1)
示例15: test_Mandarin
def test_Mandarin(self):
tu.print_test_header("test Mandarin")
tu.add_many_to_hand(self.player1, supply_cards.Silver(self.game, self.player1), 3)
tu.add_many_to_hand(self.player1, supply_cards.Gold(self.game, self.player1), 2)
tu.send_input(self.player1, "play", "Gold")
tu.send_input(self.player1, "play", "Silver")
tu.send_input(self.player1, "play", "Silver")
yield tu.send_input(self.player1, "buyCard", "Mandarin")
self.assertTrue(self.player1.last_mode["mode"] == "select")
yield tu.send_input(self.player1, "post_selection", ["Silver", "Silver", "Gold"])
self.assertTrue(len(self.player1.played_cards) == 0)
self.assertTrue(self.player1.deck[-1].title == "Gold")
self.assertTrue(self.player1.deck[-2].title == "Silver")
self.assertTrue(self.player1.deck[-3].title == "Silver")
self.player1.end_turn()
self.player2.hand.add(hl.Mandarin(self.game, self.player2))
self.player2.hand.add(supply_cards.Silver(self.game, self.player2))
tu.send_input(self.player2, "play", "Mandarin")
self.assertTrue(self.player2.balance == 3)
self.assertTrue(self.player2.last_mode["mode"] == "select")
yield tu.send_input(self.player2, "post_selection", ["Copper"])
self.assertTrue(self.player2.deck[-1].title == "Copper")
self.assertTrue(len(self.player2.hand) == 5)