本文整理汇总了Python中tests.test_utils.print_test_header函数的典型用法代码示例。如果您正苦于以下问题:Python print_test_header函数的具体用法?Python print_test_header怎么用?Python print_test_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_test_header函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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())
开发者ID:HPRC,项目名称:Dominet,代码行数:7,代码来源:game_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:7,代码来源:seaside_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:7,代码来源:seaside_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:32,代码来源:hinterlands_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:26,代码来源:prosperity_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:7,代码来源:game_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:27,代码来源:base_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:30,代码来源:base_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:25,代码来源:base_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:31,代码来源:hinterlands_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:25,代码来源:hinterlands_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:25,代码来源:hinterlands_tests.py
示例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")
开发者ID:HPRC,项目名称:Dominet,代码行数:28,代码来源:hinterlands_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:28,代码来源:prosperity_tests.py
示例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)
开发者ID:HPRC,项目名称:Dominet,代码行数:27,代码来源:hinterlands_tests.py
示例16: test_Royal_Seal
def test_Royal_Seal(self):
tu.print_test_header("test Royal Seal")
royal_seal = prosperity.Royal_Seal(self.game, self.player1)
workers_village = prosperity.Workers_Village(self.game, self.player1)
copper = supply_cards.Copper(self.game, self.player1)
self.player1.hand.add(royal_seal)
self.player1.hand.add(copper)
tu.add_many_to_hand(self.player1, workers_village, 3)
workers_village.play()
workers_village.play()
workers_village.play()
royal_seal.play()
yield tu.send_input(self.player1, "buyCard", "Curse")
self.assertTrue(self.player1.last_mode["mode"] == "select")
yield tu.send_input(self.player1, "post_selection", ["Yes"])
self.assertTrue(self.player1.deck[-1].title == "Curse")
yield gen.sleep(.2)
self.assertTrue(self.player1.last_mode["mode"] == "buy")
yield tu.send_input(self.player1, "buyCard", "Silver")
self.assertTrue(self.player1.last_mode["mode"] == "select")
yield tu.send_input(self.player1, "post_selection", ["No"])
self.assertTrue(self.player1.discard_pile[-1].title == "Silver")
yield gen.sleep(.2)
self.assertTrue(self.player1.last_mode["mode"] == "buy")
yield tu.send_input(self.player1, "buyCard", "Mint")
self.assertTrue(self.player1.last_mode["mode"] == "buy")
开发者ID:HPRC,项目名称:Dominet,代码行数:30,代码来源:prosperity_tests.py
示例17: test_Thief_3_players
def test_Thief_3_players(self):
tu.print_test_header("test Thief 3 players")
thief_card = base.Thief(self.game, self.player1)
self.player1.hand.add(thief_card)
player2gold = supply_cards.Gold(self.game, self.player2)
player3copper = supply_cards.Copper(self.game, self.player3)
self.player2.deck = [supply_cards.Estate(self.game, self.player2), player2gold]
self.player3.deck = [player3copper, supply_cards.Estate(self.game, self.player3)]
select_gain_gold_future = gen.Future()
select_gain_copper_future = gen.Future()
gain_future = gen.Future()
self.player1.select = unittest.mock.MagicMock(side_effect=[select_gain_gold_future, select_gain_copper_future])
self.player1.gain = unittest.mock.Mock(return_value=gain_future)
thief_card.play()
self.assertTrue(player2gold in self.game.trash_pile)
select_gain_gold_future.set_result(["Yes"])
yield gen.moment
self.player1.gain.assert_called_with("Gold", False)
gain_future.set_result("finish gaining gold")
yield gen.moment
self.assertTrue(player3copper in self.game.trash_pile)
select_gain_copper_future.set_result(["Yes"])
yield gen.moment
self.player1.gain.assert_called_with("Copper", False)
开发者ID:HPRC,项目名称:Dominet,代码行数:28,代码来源:base_tests.py
示例18: test_Rabble
def test_Rabble(self):
tu.print_test_header("test Rabble")
rabble = prosperity.Rabble(self.game, self.player1)
copper = supply_cards.Copper(self.game, self.player2)
estate = supply_cards.Estate(self.game, self.player2)
self.player2.deck.append(estate)
self.player2.deck.append(copper)
self.player2.deck.append(estate)
duchy = supply_cards.Duchy(self.game, self.player3)
gardens = base.Gardens(self.game, self.player3)
great_hall = intrigue.Great_Hall(self.game, self.player3)
self.player3.deck.append(duchy)
self.player3.deck.append(gardens)
self.player3.deck.append(great_hall)
rabble.play()
topdeck1 = self.player2.topdeck()
topdeck2 = self.player2.topdeck()
self.assertTrue(topdeck1.title == "Estate")
self.assertTrue(topdeck2.title == "Estate")
yield tu.send_input(self.player3, "post_selection", ["Gardens", "Duchy"])
topdeck1 = self.player3.topdeck()
topdeck2 = self.player3.topdeck()
self.assertTrue(topdeck1.title == "Duchy")
self.assertTrue(topdeck2.title == "Gardens")
开发者ID:HPRC,项目名称:Dominet,代码行数:30,代码来源:prosperity_tests.py
示例19: test_Forge_nothing
def test_Forge_nothing(self):
tu.print_test_header("test Forge nothing")
forge = prosperity.Forge(self.game, self.player1)
forge.play()
yield tu.send_input(self.player1, "post_selection", [])
self.assertTrue(self.player1.last_mode["mode"] == "selectSupply")
yield tu.send_input(self.player1, "selectSupply", ["Copper"])
self.assertTrue(len(self.player1.waiter.waiting_on) == 0)
开发者ID:HPRC,项目名称:Dominet,代码行数:8,代码来源:prosperity_tests.py
示例20: test_Border_Village
def test_Border_Village(self):
tu.print_test_header("test Border Village")
yield tu.send_input(self.player1, "buyCard", "Border Village")
yield tu.send_input(self.player1, "selectSupply", ["Duchy"])
self.assertTrue(len([x for x in self.player1.discard_pile if x.title == "Border Village"]) == 1)
self.assertTrue(len([x for x in self.player1.discard_pile if x.title == "Duchy"]) == 1)
开发者ID:HPRC,项目名称:Dominet,代码行数:8,代码来源:hinterlands_tests.py
注:本文中的tests.test_utils.print_test_header函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论