def test_amount(self): self.assertEqual(cash_money(66.53), { 50: 1, 5: 3, 1: 1, 0.25: 2, 0.01: 3 })
def test_cash_money_99_94(self): test_cad = 99.94 expected = { 0.01: 4, 0.05: 1, 0.1: 1, 0.25: 3, 2: 2, 5: 1, 20: 2, 50: 1 } self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_183_59(self): test_cad = 183.59 expected = { 0.01: 4, 0.05: 1, 0.25: 2, 1: 1, 2: 1, 10: 1, 20: 1, 50: 1, 100: 1 } self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_99_59(self): test_cad = 99.59 expected = {0.01: 4, 0.05: 1, 0.25: 2, 2: 2, 5: 1, 20: 2, 50: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_50_00(self): test_cad = 50.00 expected = {50: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_20_00(self): test_cad = 20.00 expected = {20: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_10_00(self): test_cad = 10.00 expected = {10: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_0_25(self): test_cad = 0.25 expected = {0.25: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_0_10(self): test_cad = 0.10 expected = {0.10: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_0_01(self): test_cad = 0.01 expected = {0.01: 1} self.assertEqual(expected, cash_money(test_cad))
def test_cash_money_99_95(self): test_cad = 99.95 expected = {0.1: 2, 0.25: 3, 2: 2, 5: 1, 20: 2, 50: 1} self.assertEqual(expected, cash_money(test_cad))
def test_invalid_argument(self, mock_stdout): expected_output = 'Cannot divide by that argument!\n' for i in ['a', 0]: cash_money(i) self.assertEqual(mock_stdout.getvalue(), expected_output)
def test_empty(self): self.assertEqual(cash_money(0.0), {})