<s> import unittest <EOL> from hearthbreaker . cards import ArgentSquire , DireWolfAlpha , HarvestGolem , BloodfenRaptor , MagmaRager , Wisp , Ysera <EOL> from hearthbreaker . cards . spells . neutral import TheCoin <EOL> from tests . agents . trade . test_helpers import TestHelpers <EOL> from hearthbreaker . agents . trade . possible_play import PossiblePlays <EOL> from tests . agents . trade . test_case_mixin import TestCaseMixin <EOL> class TestTradeAgentPlayTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_simple_plays ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , ArgentSquire ( ) , DireWolfAlpha ( ) , HarvestGolem ( ) ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> game . play_single_turn ( ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_will_play_biggest ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> game . players [ <NUM_LIT:0> ] . hand = self . make_cards ( game . current_player , ArgentSquire ( ) , ArgentSquire ( ) , DireWolfAlpha ( ) ) <EOL> game . players [ <NUM_LIT:0> ] . mana = <NUM_LIT:1> <EOL> game . players [ <NUM_LIT:0> ] . max_mana = <NUM_LIT:1> <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> def test_will_play_multiple ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> game . players [ <NUM_LIT:0> ] . hand = self . make_cards ( game . current_player , ArgentSquire ( ) , ArgentSquire ( ) , ArgentSquire ( ) ) <EOL> game . players [ <NUM_LIT:0> ] . mana = <NUM_LIT:1> <EOL> game . players [ <NUM_LIT:0> ] . max_mana = <NUM_LIT:1> <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_will_play_multiple_correct_order ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> game . players [ <NUM_LIT:0> ] . hand = self . make_cards ( game . current_player , ArgentSquire ( ) , ArgentSquire ( ) , ArgentSquire ( ) , <EOL> HarvestGolem ( ) ) <EOL> game . players [ <NUM_LIT:0> ] . mana = <NUM_LIT:3> <EOL> game . players [ <NUM_LIT:0> ] . max_mana = <NUM_LIT:3> <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_will_use_entire_pool ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> game . players [ <NUM_LIT:0> ] . hand = self . make_cards ( game . current_player , DireWolfAlpha ( ) , DireWolfAlpha ( ) , DireWolfAlpha ( ) , <EOL> HarvestGolem ( ) ) <EOL> game . players [ <NUM_LIT:0> ] . mana = <NUM_LIT:3> <EOL> game . players [ <NUM_LIT:0> ] . max_mana = <NUM_LIT:3> <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_will_play_three_cards ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , Wisp ( ) , ArgentSquire ( ) , DireWolfAlpha ( ) ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:3> ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> class TestTradeAgentPlayCoinTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_coin ( self ) : <EOL> game = self . make_game ( ) <EOL> cards = self . make_cards ( game . current_player , ArgentSquire ( ) , BloodfenRaptor ( ) , TheCoin ( ) ) <EOL> possible_plays = PossiblePlays ( cards , <NUM_LIT:1> ) <EOL> play = possible_plays . plays ( ) [ <NUM_LIT:0> ] <EOL> names = [ c . name for c in play . cards ] <EOL> self . assertEqual ( names , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def test_coin_save ( self ) : <EOL> game = self . make_game ( ) <EOL> cards = self . make_cards ( game . current_player , ArgentSquire ( ) , MagmaRager ( ) , TheCoin ( ) ) <EOL> possible_plays = PossiblePlays ( cards , <NUM_LIT:1> ) <EOL> play = possible_plays . plays ( ) [ <NUM_LIT:0> ] <EOL> names = [ c . name for c in play . cards ] <EOL> self . assertEqual ( names , [ "<STR_LIT>" ] ) <EOL> class TestTradeAgentHeroPowerTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_will_use_hero_power_with_empty_hand ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:10> ) <EOL> possible = PossiblePlays ( [ ] , <NUM_LIT:10> ) <EOL> play = possible . plays ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( play . cards [ <NUM_LIT:0> ] . name , "<STR_LIT>" ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> def test_wont_kill_self_with_hero_power ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:2> ) <EOL> game . players [ <NUM_LIT:0> ] . hero . health = <NUM_LIT:1> <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] ) <EOL> self . assertEqual ( game . players [ <NUM_LIT:0> ] . hero . health , <NUM_LIT:1> ) <EOL> def test_will_hero_power_first_if_inevitable ( self ) : <EOL> game = self . make_game ( ) <EOL> cards = self . make_cards ( game . current_player , DireWolfAlpha ( ) ) <EOL> possible = PossiblePlays ( cards , <NUM_LIT:10> ) <EOL> play = possible . plays ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( play . first_card ( ) . name , "<STR_LIT>" ) <EOL> def test_will_not_hero_power_if_not_inevitable ( self ) : <EOL> game = self . make_game ( ) <EOL> cards = self . make_cards ( game . current_player , Ysera ( ) ) <EOL> possible = PossiblePlays ( cards , <NUM_LIT:10> ) <EOL> play = possible . plays ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( play . first_card ( ) . name , "<STR_LIT>" ) </s>
