def test_exchange_chips_with_remainders(self): cs = ChipStack() cs._add_chips({'$25': 3}) cs.exchange_chips('$25', '$10') self.assertEqual(cs.stack['$10'], 7) self.assertEqual(cs.stack['$5'], 1) cs.stack = ChipStack.get_empty_stack() cs._add_chips({'$20': 6}) cs.exchange_chips('$20', '$50') self.assertEqual(cs.stack['$50'], 2) self.assertEqual(cs.stack['$20'], 1)
def test_add_chips(self): # create an empty stack and add another empty stack cs = ChipStack() empty_stack = { '$1': 0, '$5': 0, '$10': 0, '$20': 0, '$25': 0, '$50': 0, '$100': 0 } stack = cs.stack.copy() cs._add_chips(empty_stack) self.assertEqual(cs.stack, stack) self.assertEqual(cs.stack, empty_stack) # create an standard stack and add its stack to cs2 = ChipStack.from_standard_stack() cs._add_chips(cs2.stack) self.assertEqual(cs.stack, cs2.stack)