def test_cashmoney_large(self):
     self.assertEqual(
         cashmoney(1050), {
             0.01: 0,
             0.05: 0,
             0.1: 0,
             0.25: 0,
             1: 0,
             2: 0,
             5: 0,
             10: 0,
             20: 0,
             50: 1,
             100: 10
         })
Exemplo n.º 2
0
 def test_cashmoney_correct_values_in_dict(self):
     self.assertEqual(
         cashmoney(328.63), {
             100: 3,
             50: 0,
             20: 1,
             10: 0,
             5: 1,
             2: 1,
             1: 1,
             0.25: 2,
             0.1: 1,
             0.05: 0,
             0.01: 3
         })
 def test_cashmoney_zero(self):
     self.assertEqual(
         cashmoney(0.0), {
             100: 0,
             50: 0,
             20: 0,
             10: 0,
             5: 0,
             2: 0,
             1: 0,
             0.25: 0,
             0.1: 0,
             0.05: 0,
             0.01: 0
         })
Exemplo n.º 4
0
 def test_cashmoney_key_quarter(self):
     self.assertEqual(cashmoney(0.25)[0.25], 1)
Exemplo n.º 5
0
 def test_cashmoney_key_loonie(self):
     self.assertEqual(cashmoney(1.00)[1], 1)
Exemplo n.º 6
0
 def test_cashmoney_return_type(self):
     self.assertIsInstance(cashmoney(45.89), dict)
Exemplo n.º 7
0
 def test_cashmoney_key_toonie(self):
     self.assertEqual(cashmoney(2.00)[2], 1)
Exemplo n.º 8
0
 def test_cashmoney_key_five(self):
     self.assertEqual(cashmoney(5.00)[5], 1)
Exemplo n.º 9
0
 def test_cashmoney_key_cent(self):
     self.assertEqual(cashmoney(0.01)[0.01], 1)
Exemplo n.º 10
0
 def test_cashmoney_key_fifty(self):
     self.assertEqual(cashmoney(50.00)[50], 1)
Exemplo n.º 11
0
 def test_cashmoney_key_hundred(self):
     self.assertEqual(cashmoney(100.00)[100], 1)
Exemplo n.º 12
0
 def test_cashmoney_with_non_float(self):
     with self.assertRaises(ValueError):
         cashmoney(128)
 def test_cash_money_error(self):
     with self.assertRaises(ValueError):
         cashmoney(-19)
Exemplo n.º 14
0
 def test_cashmoney_key_ten_cents(self):
     self.assertEqual(cashmoney(0.10)[0.10], 1)
Exemplo n.º 15
0
 def test_cashmoney_key_twenty(self):
     self.assertEqual(cashmoney(20.00)[20], 1)
Exemplo n.º 16
0
 def test_cashmoney_key_five_cents(self):
     self.assertEqual(cashmoney(0.05)[0.05], 1)
Exemplo n.º 17
0
 def test_cashmoney_key_ten(self):
     self.assertEqual(cashmoney(10.00)[10], 1)
Exemplo n.º 18
0
 def test_cashmoney_with_negative_argument(self):
     with self.assertRaises(ValueError):
         cashmoney(-45.89)
 def test_cashmoney_type(self):
     self.assertIsInstance(cashmoney(87.5), dict)