def test_last_hand_raise_valid_8_cards(self): # player -1 raised world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(4, 1)] world.player_A_hand = [total_watten.get_id(5, 0)] result = world._last_hand_raise_valid() self.assertFalse(result) world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(4, 2)] world.player_A_hand = [total_watten.get_id(5, 0)] result = world._last_hand_raise_valid() self.assertTrue(result) # player 1 raised world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [total_watten.get_id(4, 1)] world.player_A_hand = [total_watten.get_id(5, 0)] result = world._last_hand_raise_valid() self.assertFalse(result) world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [total_watten.get_id(4, 2)] world.player_A_hand = [total_watten.get_id(5, 2)] result = world._last_hand_raise_valid() self.assertTrue(result)
def test_last_hand_raise_valid_9_cards(self): # trumpf # player -1 raised world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7, 8] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(4, 2)] world.player_A_hand = [total_watten.get_id(5, 0)] result = world._last_hand_raise_valid() self.assertTrue(result) # player 1 raised world = WorldTotalWatten() world.played_cards = [0, 1, 2, 3, 4, 5, 6, 7, 8] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [total_watten.get_id(4, 2)] world.player_A_hand = [total_watten.get_id(5, 2)] result = world._last_hand_raise_valid() self.assertTrue(result) # same suit # player 1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(1, 0) ] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [] world.player_A_hand = [total_watten.get_id(4, 0)] result = world._last_hand_raise_valid() self.assertTrue(result) # player -1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(1, 0) ] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(4, 0)] world.player_A_hand = [] result = world._last_hand_raise_valid() self.assertTrue(result) # card beats the played one # player 1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(1, 0) ] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [] world.player_A_hand = [total_watten.get_id(3, 2)] result = world._last_hand_raise_valid() self.assertTrue(result) # player -1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(1, 0) ] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(3, 2)] world.player_A_hand = [] result = world._last_hand_raise_valid() self.assertTrue(result) # raise was not legal # player 1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(6, 3) ] world.rank = 3 world.suit = 2 world.current_player = 1 world.player_B_hand = [] world.player_A_hand = [total_watten.get_id(1, 0)] result = world._last_hand_raise_valid() self.assertFalse(result) # player -1 raised world = WorldTotalWatten() world.played_cards = [ 0, 1, 2, 3, 4, 5, 6, 7, total_watten.get_id(6, 3) ] world.rank = 3 world.suit = 2 world.current_player = -1 world.player_B_hand = [total_watten.get_id(1, 0)] world.player_A_hand = [] result = world._last_hand_raise_valid() self.assertFalse(result)