# Path: MTG/mana.py
# class Mana(Enum):
# class ManaPool():
#     WHITE = 0
#     BLUE = 1
#     BLACK = 2
#     RED = 3
#     GREEN = 4
#     COLORLESS = 5
#     GENERIC = 6
# def str_to_mana_dict(manacost):
# def chr_to_mana(c):
#     def __init__(self, controller=None):
#     def add(self, mana, amount=1):
#     def add_str(self, mana_str):
#     def pay(self, manacost):
#     def is_empty(self):
#     def determine_costs(self, manacost):
#     def canPay(self, manacost, convoke=False):
#     def clear(self):
#     def __repr__(self):
# 
# Path: MTG/player.py
# class Player():
#     def __init__(self, deck, name='player',
#                  startingLife=20, maxHandSize=7, game=None):
#     def __repr__(self):
#     def __str__(self):
#     def __eq__(x, y):
#     def __hash__(self):
#     def is_active(self):
#     def opponent(self):
#     def creatures(self):
#     def lands(self):
#     def stack(self):
#     def get_zone(self, zone_type):
#     def get_action(self):
#     def make_choice(self, prompt_string):
#     def make_choice_items_in_list(self, items, num=1, up_to=False, repetition=False):
#     def add_static_effect(self, name, value, source, toggle_func, exempt_source=False):
#     def remove_static_effect(self, source):
#     def trigger(self, condition, source=None, amount=1):
#             def f(p):
#             def f(p):
#     def play_card(self, card):
#     def draw(self, num=1):
#     def add_card_to_hand(self, card):
#     def search_lib(self, criteria_funcs, num=1, target_zone='hand', todo_func=None, face_up=True):
#     def discard(self, num=1, down_to=None, rand=False):
#     def mill(self, num=1):
#     def create_token(self, attributes, num=1, keyword_abilities=[], activated_abilities=[]):
#     def investigate(self, num=1):
#     def boolster(self, num=1):
#     def sacrifice(self, num=1, filter_func=lambda p: p.is_creature):
#     def pay(self, mana=None, life=0):
#     def take_damage(self, source, dmg, is_combat=False):
#     def gain_life(self, amount):
#     def lose_life(self, amount):
#     def set_life_total(self, value):
#     def end_turn(self):
#     def controls(self, subtype=None, types=None, supertype=None):
#     def apply_to_zone(self, apply_func, zone, condition=lambda p: True):
#     def apply_to_battlefield(self, apply_func, condition=lambda p: True):
#     def lose(self):
#     def print_player_state(self):
#                     PLAYER_PREVIOUS_STATE = deepcopy(self)


import mock
import unittest
from collections import defaultdict
from MTG import mana
from MTG import player
        cls.m.controller = player.Player([])
        cls.m.pool[mana.Mana.BLUE] = 4
        cls.m.pool[mana.Mana.WHITE] = 3

    def test_basic_mana_payment(self):
        self.assertEqual(self.m.canPay('U')[mana.Mana.BLUE], 1)
        c = self.m.canPay('UUW')
        self.assertEqual(c[mana.Mana.BLUE], 2)
        self.assertEqual(c[mana.Mana.WHITE], 1)

    def test_numbers_in_mana_costs(self):
        with mock.patch('builtins.input', return_value=''):
            self.assertEqual(type(self.m.canPay('4U')), defaultdict)
            self.assertTrue(self.m.canPay('7'))
            self.assertTrue(self.m.canPay('0'))
            self.assertFalse(self.m.canPay('1R'))

        with mock.patch('builtins.input', side_effect=['RUUW']):
            self.assertFalse(self.m.canPay('4U'))

    def test_hybrid_mana_costs(self):
        with mock.patch('builtins.input', side_effect=['0', '0', '0', '']):
            c = self.m.canPay('(2/R)(2/W)(2/U)')
            self.assertEqual(c[mana.Mana.BLUE] + c[mana.Mana.WHITE], 6)

        with mock.patch('builtins.input', side_effect=['1', '0', '1', '']):
            self.assertFalse(self.m.canPay('(U/R)(2/W)(2/U)'))

        with mock.patch('builtins.input', side_effect=['0', '1', '1', 'UU']):
            c = self.m.canPay('U(2/R)(G/W)(W/U)')

# Path: MTG/mana.py
# class Mana(Enum):
# class ManaPool():
#     WHITE = 0
#     BLUE = 1
#     BLACK = 2
#     RED = 3
#     GREEN = 4
#     COLORLESS = 5
#     GENERIC = 6
# def str_to_mana_dict(manacost):
# def chr_to_mana(c):
#     def __init__(self, controller=None):
#     def add(self, mana, amount=1):
#     def add_str(self, mana_str):
#     def pay(self, manacost):
#     def is_empty(self):
#     def determine_costs(self, manacost):
#     def canPay(self, manacost, convoke=False):
#     def clear(self):
#     def __repr__(self):
# 
# Path: MTG/player.py
# class Player():
#     def __init__(self, deck, name='player',
#                  startingLife=20, maxHandSize=7, game=None):
#     def __repr__(self):
#     def __str__(self):
#     def __eq__(x, y):
#     def __hash__(self):
#     def is_active(self):
#     def opponent(self):
#     def creatures(self):
#     def lands(self):
#     def stack(self):
#     def get_zone(self, zone_type):
#     def get_action(self):
#     def make_choice(self, prompt_string):
#     def make_choice_items_in_list(self, items, num=1, up_to=False, repetition=False):
#     def add_static_effect(self, name, value, source, toggle_func, exempt_source=False):
#     def remove_static_effect(self, source):
#     def trigger(self, condition, source=None, amount=1):
#             def f(p):
#             def f(p):
#     def play_card(self, card):
#     def draw(self, num=1):
#     def add_card_to_hand(self, card):
#     def search_lib(self, criteria_funcs, num=1, target_zone='hand', todo_func=None, face_up=True):
#     def discard(self, num=1, down_to=None, rand=False):
#     def mill(self, num=1):
#     def create_token(self, attributes, num=1, keyword_abilities=[], activated_abilities=[]):
#     def investigate(self, num=1):
#     def boolster(self, num=1):
#     def sacrifice(self, num=1, filter_func=lambda p: p.is_creature):
#     def pay(self, mana=None, life=0):
#     def take_damage(self, source, dmg, is_combat=False):
#     def gain_life(self, amount):
#     def lose_life(self, amount):
#     def set_life_total(self, value):
#     def end_turn(self):
#     def controls(self, subtype=None, types=None, supertype=None):
#     def apply_to_zone(self, apply_func, zone, condition=lambda p: True):
#     def apply_to_battlefield(self, apply_func, condition=lambda p: True):
#     def lose(self):
#     def print_player_state(self):
#                     PLAYER_PREVIOUS_STATE = deepcopy(self)


# Path: MTG/test/test_mana.py
import mock
import unittest
from collections import defaultdict
from MTG import mana
from MTG import player

        cls.m.controller = player.Player([])
        cls.m.pool[mana.Mana.BLUE] = 4
        cls.m.pool[mana.Mana.WHITE] = 3

    def test_basic_mana_payment(self):
        self.assertEqual(self.m.canPay('U')[mana.Mana.BLUE], 1)
        c = self.m.canPay('UUW')
        self.assertEqual(c[mana.Mana.BLUE], 2)
        self.assertEqual(c[mana.Mana.WHITE], 1)

    def test_numbers_in_mana_costs(self):
        with mock.patch('builtins.input', return_value=''):
            self.assertEqual(type(self.m.canPay('4U')), defaultdict)
            self.assertTrue(self.m.canPay('7'))
            self.assertTrue(self.m.canPay('0'))
            self.assertFalse(self.m.canPay('1R'))

        with mock.patch('builtins.input', side_effect=['RUUW']):
            self.assertFalse(self.m.canPay('4U'))

    def test_hybrid_mana_costs(self):
        with mock.patch('builtins.input', side_effect=['0', '0', '0', '']):
            c = self.m.canPay('(2/R)(2/W)(2/U)')
            self.assertEqual(c[mana.Mana.BLUE] + c[mana.Mana.WHITE], 6)

        with mock.patch('builtins.input', side_effect=['1', '0', '1', '']):
            self.assertFalse(self.m.canPay('(U/R)(2/W)(2/U)'))

        with mock.patch('builtins.input', side_effect=['0', '1', '1', 'UU']):
            c = self.m.canPay('U(2/R)(G/W)(W/U)')

            self.assertEqual(c[mana.Mana.BLUE], 4)