<s> import unittest <EOL> from hearthbreaker . cards import Wisp , WarGolem , BloodfenRaptor , GoldshireFootman , RiverCrocolisk , MagmaRager , ChillwindYeti , Voidwalker , AmaniBerserker , AbusiveSergeant , DarkIronDwarf , ShatteredSunCleric , ImpMaster , ElvenArcher , Shieldbearer , StormpikeCommando <EOL> from hearthbreaker . cards . base import MinionCard <EOL> from hearthbreaker . game_objects import Hero <EOL> from tests . agents . trade . test_helpers import TestHelpers , TempCard <EOL> from tests . agents . trade . test_case_mixin import TestCaseMixin <EOL> class TestTradeAgentAttackBasicTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_will_attack_face ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . add_minions ( game , <NUM_LIT:0> , BloodfenRaptor ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , game . players [ <NUM_LIT:1> ] . hero . health ) <EOL> def test_will_attack_minion_and_face ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . add_minions ( game , <NUM_LIT:1> , Wisp ( ) ) <EOL> self . add_minions ( game , <NUM_LIT:0> , BloodfenRaptor ( ) , RiverCrocolisk ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , game . players [ <NUM_LIT:1> ] . hero . health ) <EOL> def test_will_respect_taunt ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . add_minions ( game , <NUM_LIT:1> , Wisp ( ) , GoldshireFootman ( ) ) <EOL> self . add_minions ( game , <NUM_LIT:0> , BloodfenRaptor ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> def test_will_attack_twice ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . add_minions ( game , <NUM_LIT:1> , Wisp ( ) , GoldshireFootman ( ) ) <EOL> self . add_minions ( game , <NUM_LIT:0> , BloodfenRaptor ( ) , RiverCrocolisk ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_trades_obj_smoke ( self ) : <EOL> me = [ BloodfenRaptor ( ) , RiverCrocolisk ( ) ] <EOL> opp = [ Wisp ( ) , WarGolem ( ) ] <EOL> trades = self . make_trades ( me , opp ) <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:6> ) <EOL> class TestTradeAgentAttackTradesTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_trades_smart ( self ) : <EOL> game = self . make_game ( ) <EOL> me = self . make_cards ( game . current_player , MagmaRager ( ) ) <EOL> opp = self . make_cards ( game . other_player , Wisp ( ) , ChillwindYeti ( ) ) <EOL> trades = self . make_trades ( me , opp ) <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( trades . trades ( ) [ <NUM_LIT:0> ] . opp_minion . name , "<STR_LIT>" ) <EOL> def test_trades_smart2 ( self ) : <EOL> game = self . make_game ( ) <EOL> me = self . make_cards ( game . current_player , Voidwalker ( ) ) <EOL> opp = self . make_cards ( game . other_player , Wisp ( ) , ChillwindYeti ( ) ) <EOL> trades = self . make_trades ( me , opp ) <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( trades . trades ( ) [ <NUM_LIT:0> ] . opp_minion . name , "<STR_LIT>" ) <EOL> def test_trades_smart3 ( self ) : <EOL> me = [ Voidwalker ( ) ] <EOL> opp = [ ChillwindYeti ( ) ] <EOL> trades = self . make_trades ( me , opp ) <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( trades . trades ( ) [ <NUM_LIT:0> ] . opp_minion . __class__ , Hero ) <EOL> class TestProperBuffs ( TestCaseMixin , unittest . TestCase ) : <EOL> def test_smoke ( self ) : <EOL> self . assertEqual ( <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> def test_abusive ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , AbusiveSergeant ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , Wisp ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , RiverCrocolisk ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> def test_dwarf ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , DarkIronDwarf ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , Wisp ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , RiverCrocolisk ( ) ) <EOL> game . players [ <NUM_LIT:0> ] . mana = <NUM_LIT:4> <EOL> game . players [ <NUM_LIT:0> ] . max_mana = <NUM_LIT:4> <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> def test_cleric ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , ShatteredSunCleric ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , Wisp ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , BloodfenRaptor ( ) ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:3> ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> def test_cleric_buff_to_keep_alive ( self ) : <EOL> return <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , ShatteredSunCleric ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , MagmaRager ( ) , Wisp ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , ImpMaster ( ) ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:3> ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> def test_archer_attacks_enemy ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , ElvenArcher ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , Shieldbearer ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , BloodfenRaptor ( ) ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assertEqual ( game . players [ <NUM_LIT:1> ] . minions [ <NUM_LIT:0> ] . health , <NUM_LIT:1> ) <EOL> def test_commando_attacks_enemy ( self ) : <EOL> game = TestHelpers ( ) . make_game ( ) <EOL> self . set_hand ( game , <NUM_LIT:0> , StormpikeCommando ( ) ) <EOL> self . set_board ( game , <NUM_LIT:0> , Wisp ( ) ) <EOL> self . set_board ( game , <NUM_LIT:1> , BloodfenRaptor ( ) ) <EOL> self . set_mana ( game , <NUM_LIT:0> , <NUM_LIT:5> ) <EOL> self . make_all_active ( game ) <EOL> game . play_single_turn ( ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:0> ] , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . assert_minions ( game . players [ <NUM_LIT:1> ] ) <EOL> class TestTradeAgentAttackLethalTests ( TestCaseMixin , unittest . TestCase ) : <EOL> def make_minions ( self , * strs ) : <EOL> res = [ ] <EOL> for s in strs : <EOL> if isinstance ( s , MinionCard ) : <EOL> res . append ( s ) <EOL> else : <EOL> m = TempCard . make ( s ) <EOL> res . append ( m ) <EOL> return res <EOL> def test_lethal ( self ) : <EOL> me = [ ChillwindYeti ( ) ] <EOL> opp = [ AmaniBerserker ( ) ] <EOL> a = self . make_trades2 ( me , opp ) <EOL> trades = a [ <NUM_LIT:1> ] <EOL> game = a [ <NUM_LIT:0> ] <EOL> game . players [ <NUM_LIT:1> ] . hero . health = <NUM_LIT:1> <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( trades . trades ( ) [ <NUM_LIT:0> ] . opp_minion . __class__ , Hero ) <EOL> def test_lethal_with_two ( self ) : <EOL> me = [ ChillwindYeti ( ) , WarGolem ( ) ] <EOL> opp = [ AmaniBerserker ( ) ] <EOL> a = self . make_trades2 ( me , opp ) <EOL> trades = a [ <NUM_LIT:1> ] <EOL> game = a [ <NUM_LIT:0> ] <EOL> game . players [ <NUM_LIT:1> ] . hero . health = <NUM_LIT:10> <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( trades . trades ( ) [ <NUM_LIT:0> ] . opp_minion . __class__ , Hero ) <EOL> def test_lethal_with_taunt ( self ) : <EOL> me = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> opp = self . make_minions ( "<STR_LIT>" ) <EOL> def cb ( g ) : <EOL> g . players [ <NUM_LIT:1> ] . hero . health = <NUM_LIT:3> <EOL> game , trades = self . make_trades2 ( me , opp , cb ) <EOL> trade = trades . trades ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( trade . my_minion . health , <NUM_LIT:9> ) <EOL> def test_lethal_with_taunt2 ( self ) : <EOL> me = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> opp = self . make_minions ( "<STR_LIT>" ) <EOL> def cb ( g ) : <EOL> g . players [ <NUM_LIT:1> ] . hero . health = <NUM_LIT:3> <EOL> game , trades = self . make_trades2 ( me , opp , cb ) <EOL> trade = trades . trades ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( trade . my_minion . health , <NUM_LIT:8> ) <EOL> def test_good_trade_with_taunt2 ( self ) : <EOL> me = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> opp = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> game , trades = self . make_trades2 ( me , opp ) <EOL> trade = trades . trades ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( len ( trades . trades ( ) ) , <NUM_LIT:3> ) <EOL> self . assertEqual ( trade . my_minion . health , <NUM_LIT:6> ) <EOL> self . assertEqual ( trade . opp_minion . health , <NUM_LIT:2> ) <EOL> def test_lots ( self ) : <EOL> me = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> opp = self . make_minions ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> game , trades = self . make_trades2 ( me , opp ) <EOL> trade = trades . trades ( ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( not trade , False ) </s>
