def test_win_mighty(self): cards = [ { 'rank': 'JK', 'suit': 'S' }, { 'rank': 'A', 'suit': 'S' }, { 'rank': 'A', 'suit': 'C' }, { 'rank': 'A', 'suit': 'D' }, { 'rank': 'K', 'suit': 'S' }, ] win = win_card(cards, 'C', False) self.assertEqual(win, 1) win = win_card(cards, 'S', False) self.assertEqual(win, 3)
def test_win_table_suit(self): cards = [ { 'rank': 'K', 'suit': 'D' }, { 'rank': '2', 'suit': 'D' }, { 'rank': 'A', 'suit': 'D' }, { 'rank': 'J', 'suit': 'D' }, { 'rank': 'Q', 'suit': 'D' }, ] win = win_card(cards, 'N', False) self.assertEqual(win, 2) win = win_card(cards, 'C', False) self.assertEqual(win, 2)
def test_win_first_turn_joker(self): cards = [ { 'rank': '3', 'suit': 'C' }, { 'rank': '2', 'suit': 'D' }, { 'rank': 'A', 'suit': 'C' }, { 'rank': 'JK', 'suit': None }, { 'rank': 'K', 'suit': 'C' }, ] win = win_card(cards, 'H', False, round=1) self.assertEqual(win, 2)
def test_win_joker_call(self): cards = [ { 'rank': '3', 'suit': 'C' }, { 'rank': '2', 'suit': 'D' }, { 'rank': 'A', 'suit': 'C' }, { 'rank': 'JK', 'suit': None }, { 'rank': 'K', 'suit': 'C' }, ] win = win_card(cards, 'H', True) self.assertEqual(win, 2)
def test_win_joker(self): cards = [ { 'rank': 'A', 'suit': 'H' }, { 'rank': 'A', 'suit': 'D' }, { 'rank': 'A', 'suit': 'C' }, { 'rank': 'JK', 'suit': None }, { 'rank': 'K', 'suit': 'S' }, ] win = win_card(cards, 'C', False) self.assertEqual(win, 3)
def test_win_giruda(self): cards = [ { 'rank': 'K', 'suit': 'D' }, { 'rank': 'A', 'suit': 'D' }, { 'rank': '2', 'suit': 'C' }, { 'rank': 'J', 'suit': 'C' }, { 'rank': 'Q', 'suit': 'D' }, ] win = win_card(cards, 'C', False) self.assertEqual(win, 3)
def test_win_not_five_cards(self): cards = [{'rank': '2', 'suit': 'S'}] win = win_card(cards, 'H', False) self.assertEqual(win, 0) cards = [ { 'rank': '2', 'suit': 'S' }, { 'rank': '4', 'suit': 'S' }, { 'rank': '3', 'suit': 'S' }, ] win = win_card(cards, 'H', False) self.assertEqual(win, 1)